Help With Redirecting Using htaccess File!

  • Steve[D]
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Oct 07, 2008
  • Posts: 5
  • Status: Offline

Post November 5th, 2009, 9:19 am

Hi,

I currently have four links to my forum as listed below:

Code: [ Download ] [ Select ]
http://mysite .com/forum/
http://mysite .com/forum/index.php
http://www.mysite .com/forum/
http://www.mysite .com/forum/index.php
  1. http://mysite .com/forum/
  2. http://mysite .com/forum/index.php
  3. http://www.mysite .com/forum/
  4. http://www.mysite .com/forum/index.php



Ive heard that Google can mistake these for 4 different websites which can lead to split results and poor ranking. So how can I edit my .htaccess file so that each of the above redirects to just one;

Code: [ Download ] [ Select ]
http://www.mysite .com/forum/



Im using vbulletin, if that makes any difference.

Many Thanks,
Steve. :D
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 5th, 2009, 9:19 am

  • joebert
  • Weathered
  • Genius
  • User avatar
  • Joined: Feb 10, 2004
  • Posts: 11878
  • Loc: Clearwater, FL
  • Status: Offline

Post November 5th, 2009, 10:13 am

Why yes, yes I am.
  • Steve[D]
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Oct 07, 2008
  • Posts: 5
  • Status: Offline

Post November 5th, 2009, 10:59 am

Hi,

Thanks for the quick reply. I have something similar as to what is suggested in that thread.

Unfortuately, there seems to be a conflict between the .htaccess file in the root directory (mysite .com/) which contains the following:

Code: [ Download ] [ Select ]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteCond %{HTTPS} =on
RewriteRule .* https://www.%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteCond %{HTTPS} !=on
RewriteRule .* http://www.%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://www.mysite .com/$1 [R=301,L]
  1. RewriteEngine on
  2. RewriteCond %{HTTP_HOST} ^mysite\.com
  3. RewriteCond %{HTTPS} =on
  4. RewriteRule .* https://www.%{SERVER_NAME}%{REQUEST_URI} [R,L]
  5. RewriteCond %{HTTP_HOST} ^mysite\.com
  6. RewriteCond %{HTTPS} !=on
  7. RewriteRule .* http://www.%{SERVER_NAME}%{REQUEST_URI} [R,L]
  8. RewriteCond %{THE_REQUEST} ^.*/index.html
  9. RewriteRule ^(.*)index.html$ http://www.mysite .com/$1 [R=301,L]




And the one in the forum subdirectory (mysite .com/forum/) which contains the following - required by an add on Im using:

Code: [ Download ] [ Select ]
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([a-z0-9_\-]*-(f|all)[0-9]+(p[0-9]+|/index[0-9]*)?\.html)$ forumdisplay.php/$1 [QSA,L]
RewriteRule ^([a-z0-9_\-]*-(t|p)[0-9]+(p[0-9]+|/index[0-9]*)?\.html)$ showthread.php/$1 [QSA,L]
RewriteCond %{REQUEST_URI} !(index\.php|\.css) [NC]
RewriteRule ^(archive|sitemap)/(.*)$ $1/index.php/$2 [QSA,L]
  1. Options +FollowSymlinks
  2. RewriteEngine on
  3. RewriteRule ^([a-z0-9_\-]*-(f|all)[0-9]+(p[0-9]+|/index[0-9]*)?\.html)$ forumdisplay.php/$1 [QSA,L]
  4. RewriteRule ^([a-z0-9_\-]*-(t|p)[0-9]+(p[0-9]+|/index[0-9]*)?\.html)$ showthread.php/$1 [QSA,L]
  5. RewriteCond %{REQUEST_URI} !(index\.php|\.css) [NC]
  6. RewriteRule ^(archive|sitemap)/(.*)$ $1/index.php/$2 [QSA,L]



Since when I remove the latter the force www. does work!

Can anyone spot the problem?
Thanks! :)
  • Steve[D]
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Oct 07, 2008
  • Posts: 5
  • Status: Offline

Post November 5th, 2009, 11:35 am

UPDATE:

Ok, In the end I removed the htaccess file from the forum subdirectory as I found another way to achieve the same thing.


Im wondering if I could also use the htaccess file to redirect from;


http://www.mysite .com/forums

to

http://www.mysite .com/forum


Should visitors accidentally misspell the URL.
  • joebert
  • Weathered
  • Genius
  • User avatar
  • Joined: Feb 10, 2004
  • Posts: 11878
  • Loc: Clearwater, FL
  • Status: Offline

Post November 5th, 2009, 1:45 pm

I'm reluctant to suggest this because you mentioned that you "found another way", but haven't mentioned what that is, but here's the rewrite assuming I'm working from square one.

APACHE Code: [ Download ] [ Select ]
RewriteEngine On
RewriteBase /
 
RewriteRule ^forums(/.*)?$ forum$1 [R=301]
  1. RewriteEngine On
  2. RewriteBase /
  3.  
  4. RewriteRule ^forums(/.*)?$ forum$1 [R=301]
Why yes, yes I am.

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 156 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.