Forum Moderators: phranque

Message Too Old, No Replies

non www to www adding extra /

         

AngelsAdvocate

6:38 am on Jun 2, 2006 (gmt 0)

10+ Year Member



Hello all, I'm using the following code for a phpbb forum of mine that has recently been given its own subdomain where it previously was linked to as: domain.com/phpbb2/

The .htaccess code I'm using is:

Options +FollowSymlinks -indexes
RewriteEngine on

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\.forum\.domain\.com [NC]
RewriteRule (.*) [forum.domain.com...] [R=301,L]

Which works well for my sites but on my forum if the original url contains a '/' forward slash .. it is still added to the end of the re-directed url.

This:
[domain.com...]

Becomes:
[forum.domain.com...]

(notice the extra forward slash ...)

Anyone know how this can be corrected?

coopster

4:58 pm on Jun 2, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, AngelsAdvocate.

How about adding a rule that checks for the standalone slash?

jdMorgan

9:47 pm on Jun 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If your code is in .htaccess, and not in httpd.conf, then this slash is the result of a misconfiguration elsewhere in the server setup. If the code is actually in httpd.conf, then there's an error in it, because it should read:

RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule [b]^/[/b](.*) http://www.domain.com/$1 [R=301,L]

Jim

[edit] Corrected formatting [/edit]