vBulletin Search Engine Optimization
This is a discussion on Redirecting the xxx.com to www.xxx.com within the General Discussion forums, part of the vBSEO SEO Plugin category; Hi, I noticed today that my website can be visited via both www and without www url. Code: RewriteCond %{HTTP_HOST} ...
| |||||||
Enhancing 80 million pages. | Register | FAQ | Members List | Social Groups | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| ||||
| ||||
|
Hi, I noticed today that my website can be visited via both www and without www url. Code: RewriteCond %{HTTP_HOST} !^www\.msxlabs\.org
RewriteRule (.+) http://www.msxlabs.org%{REQUEST_URI} [R=301,L]
Example: msxlabs.org/legend.php is redirected to www.msxlabs.org/legend.php Domain access: msxlabs.org - www.msxlabs.org What's wrong or missing? Btw, vbseo.com is redirected to www.vbseo.com Apache 2.2.6 (PHP 5.2.5) |
|
#2
| ||||
| ||||
|
What is the entire contents of the .htaccess in the root of the site? The lines you need would be: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.msxlabs\.org RewriteRule (.*) http://www.msxlabs.org/$1 [L,R=301] |
|
#3
| ||||
| ||||
| Quote:
Code: <Directory /home/msxorg/public_html>
Options All -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.msxlabs\.org
RewriteRule (.+) http://www.msxlabs.org%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_REFERER} !^http://www.msxlabs.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.msxlabs.org$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|swf|mp3|mpeg|mpg|ram|rm|wma|wav|asx|wmv|avi|mov|zip|rar|exe)$ http://www.msxlabs.org [NC,R,L]
RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
#ErrorDocument 404 /forum/ [R=301,L]
</Directory>
<Directory /home/msxorg/public_html/forum>
Options All -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.msxlabs\.org
RewriteRule (.+) http://www.msxlabs.org%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_REFERER} !^http://www.msxlabs.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.msxlabs.org$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|swf|mp3|mpeg|mpg|ram|rm|wma|wav|asx|wmv|avi|mov|zip|rar|exe)$ http://www.msxlabs.org [NC,R,L]
RewriteCond %{QUERY_STRING} !vbseourl=
RewriteCond %{REQUEST_URI} !(admineu/|modmsx/|chat|cron)
RewriteRule ^(.*\.php)$ vbseo.php?vbseourl=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif)$
RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(admineu|modmsx|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]
</Directory>
<Directory /home/msxorg/public_html/forum/tags>
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.+)/([0-9]+)/$ index.php?tag=$1&page=$2 [NC,QSA,L]
RewriteRule ^(.+)/$ index.php?tag=$1 [NC,QSA,L]
</Directory>
|
|
#4
| |||
| |||
|
When I tried to use that same code you suggested for redirection it didn't work right in my case. This is what I put in my .htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.pimprig\.com RewriteRule (.*) http://www.pcapex.com/$1 [L,R=301] As you can see, I want to forward requests for pimprig.com to pcapex.com. I also have a bunch of subdomains I need to do this for as well. However, when I used those lines of code in my .htaccess file and try to access my site at any url, it displays a Red Hat Linux default test page?! Any other ideas? EDIT // I uncommented the rewrite rules for the forum and that subdomain now works great. Anyone trying to go to a url at forums.pimprig.com are forwarded to the same URL at forums.pcapex.com. Why in the world won't it work for the root domain? Last edited by GlitterKill; 11-25-2007 at 06:27 PM. |
|
#5
| ||||
| ||||
|
It should be: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.pcapex\.com RewriteRule (.*) http://www.pcapex.com/$1 [L,R=301] That will redirect anything that is NOT www.pcapex.com to www.pcapex.com. The ! means NOT.
__________________ Keith Cohen / Crawlability Inc. vBSEO 3.2.0 Launched - Maximum Overdrive for Your Web Traffic! Over 100 Instant SEO Optimizations vBSEO Google Sitemap Generator - Version 2.2 Released Mandatory Upgrade for vBSEO 3.2.0 GOLD 6X Traffic - $1400 in One Day with vBSEO! Imagine What the vBSEO Patent Pending Technology Can Do For You. My Personal Sites: My Blog | GPS Discussion Forum |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sitemap links in footer redirecting | Dave Hybrid | Troubleshooting | 5 | 05-30-2007 11:43 AM |
| vbseocp.php redirecting to itself? | Boliga.dk | Troubleshooting | 1 | 03-17-2007 11:19 AM |
| Redirecting a Url | cathiejones | General Discussion | 1 | 07-27-2006 06:41 PM |
| The page isn't redirecting properly | creativepart | Troubleshooting | 3 | 07-21-2006 03:59 PM |