Solved

htaccess - forcing a shorter url

Posted on 2006-06-25
3
171 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
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
flashwebhost earned 500 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
PHP clean up nicely even if user abort 13 49
Service "nameserver" appears to be down 4 475
XAMPP 14 40
PHP in Apache server 20 81
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now