View Full Version : 301 Redirect to your www URL
Joeychgo
07-04-2006, 08:53 PM
You want consistancy in your URLs.
Prior to making this site a link to http://vBulletin-faq.com Search Engines didnt credit the URL http://www.vBulletin-faq.com
Now they do. And it is easy. This is something everyone should do. Basically, it tells browsers and search engines that http://vBulletin-faq.com (http://vbulletin-faq.com/) is really http://www.vBulletin-faq.com.
On your server, you'll find a file called .htaccess in your root directory, usually public_html. Download that file and open it with a text editor such as TextPad (http://www.textpad.com/).
At the end of the code add the code listed below. (alter the code with your own URL) Then just upload the new file.
Here is the code used here on vBFAQ
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.vbulletin-faq\.com
RewriteRule (.*) http://www.vbulletin-faq.com/$1 [R=301,L]
Just replace the urls with your own... Other then that, make SURE it is identical to whats above.
Peggy
07-05-2006, 02:13 AM
done. and thanks
Elpie
07-05-2006, 04:38 AM
The best solution, however, is if you can get your host to make a small change through BIND/Local DNS. If you can edit the local DNS for the domain itself, simply add a CNAME record with the non-www version pointing to the www version (or vice versa, depending on which configuration you prefer).
The reason that this is the better solution is that every directive you add to .htaccess increases server processing and impacts on performance.
Scribbller
07-11-2006, 07:18 PM
Joey here is a problem I hope you can sort this out for me, my site http://www.pakpassion.net works fine as http://pakpassion.net is redirected to http://www.pakpassion.net but when it comes to internal urls like say http://www.pakpassion.net/ppforum/, the url http://pakpassion.net/ppforum/ is not redirected to former. I hope you can help with this.
Regards
Joeychgo
07-11-2006, 09:30 PM
Yours should look like this:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.pakpassion.net
RewriteRule (.*) http://www.pakpassion.net/$1 [R=301,L]
Does it? This works fine for us here,,,
Scribbller
07-12-2006, 04:17 AM
Yup that is exactly how it looks on my .htaccess
Scribbller
07-14-2006, 12:34 PM
still no luck :( do I need the .htaccess file in all my directories or just the public_html one?
Noppid
07-14-2006, 01:17 PM
It's usually in public_HTML
Notorious
07-19-2006, 08:54 AM
.htaccess code works for the forum (which is in root) but subdomians doesnt work..
The best solution, however, is if you can get your host to make a small change through BIND/Local DNS. If you can edit the local DNS for the domain itself, simply add a CNAME record with the non-www version pointing to the www version (or vice versa, depending on which configuration you prefer).
The reason that this is the better solution is that every directive you add to .htaccess increases server processing and impacts on performance.
how to do this,what exactly to enter in cname records
Peggy
07-30-2006, 10:30 PM
I opened the htaccess file for my new site and it's completely blank :confused:
Noppid
07-31-2006, 02:02 AM
I opened the htaccess file for my new site and it's completely blank :confused:
That is very often the case. Sometimes it may not exist at all.
Noppid
07-31-2006, 02:05 AM
.htaccess code works for the forum (which is in root) but subdomians doesnt work..
how to do this,what exactly to enter in cname records
Are you saying your forums can be accessed from www.example.com and forums.example.com?
That is itself is not something you want to do as now you have two domains with the exact same content.
If that's not the case, maybe you can clear up what you mean by giving a few links as examples.
Thanks
Notorious
07-31-2006, 09:47 AM
Are you saying your forums can be accessed from www.example.com and forums.example.com?
That is itself is not something you want to do as now you have two domains with the exact same content.
If that's not the case, maybe you can clear up what you mean by giving a few links as examples.
Thanks
forums works fine but files.example.com or gallery.example.com would also take to www.example.com
Big Dan
12-29-2006, 12:06 PM
I cannot tell you how many times this has been a great point of reference for me when rolling out new domains. Just saying Thanx. :)
-Danny
valdeztke
01-22-2007, 09:40 PM
Wow... I spent the last half an hour looking for that code in my file...lol
Then I reread and saw that it said ADD TO what a dummy head I can be :pan:
Dave A
10-01-2007, 11:28 AM
A slightly more generic version for this:
RewriteCond %{HTTP_HOST} !^www
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
Same princicple without the domain specific edit.
Powered by vBulletin® Version 4.2.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.