Solved

htaccess - forcing a shorter url

Posted on 2006-06-25
3
173 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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