Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

htaccess - forcing a shorter url

Posted on 2006-06-25
3
Medium Priority
?
178 Views
Last Modified: 2010-03-04
I just want to know how to config the htaccess to do this one function:

say someone comes in typing www.domain.dom 

I want to have them arrive at domain.com

Same true for all links. Anything that comes in with www. it trims it out. I just want to keep my url short for when google indexes me the first time.
0
Comment
Question by:mcsolas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
flashwebhost earned 2000 total points
ID: 16980118
Create a .htaccess file with following content

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]

You can find more info at

http://www.scriptinstallation.in/redirect_301_domain.html
0
 
LVL 1

Author Comment

by:mcsolas
ID: 16980130
I found this snippet on this page:
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

RewriteCond %{HTTP_HOST}   !^fully\.qualified\.domain\.name [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://fully.qualified.domain.name/$1 [L,R]

I think this is just about what I need. Still could use a little advice.
0
 
LVL 1

Author Comment

by:mcsolas
ID: 16980319
works perfect its already functioning for me :)

http://www.pacificallsurf.com/

redirects perfectly.

I had 2 of those lines in the joomla code already. I simply put them in the same order and it seems to be working within the other commands joomla is doing on the url.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question