Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

htaccess - forcing a shorter url

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
mcsolas
Asked:
mcsolas
  • 2
1 Solution
 
flashwebhostCommented:
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
 
mcsolasAuthor Commented:
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
 
mcsolasAuthor Commented:
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now