Forum Moderators: phranque
redirect 301 /phpbb2/ [forum.domain.com...]
I guess this is all I need to do and it should work well, have tested and seems ok. Now hoping Google won't punish me for it.
Glad you found an answer and tested succesfully.
Jim
RewriteEngine On
#
#RewriteCond %{HTTP_HOST}!^sub\.
#RewriteRule ^(.*)$ [sub.domain.tld...] [L,R=301]
however it is rewriting the url with the derectory structure.
ie:
[sub.domain.tld...]
what am I doing wrong?
Thanks in advance
Ross
RewriteCond %{HTTP_HOST} !^sub\.
RewriteRule ^(.*)[b]/sub/?[/b]$ http://sub.domain.tld/$1 [L,R=301]
I changed it to this
RewriteCond %{HTTP_HOST} !^sub\.
RewriteRule ^(.*)/?$ http://sub.domain.tld/$1 [L,R=301]
and it works, to redirect/rewrite the url to sub.domain.tld. However it messes up the furls, which after this adjustment return a 500 Internal Server Error
here's all of my file
RewriteEngine On
RewriteCond %{HTTP_HOST} !^sfl\.
RewriteRule ^(.*)/?$ http://sfl.example.com/$1 [L,R=301]
#
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
when #RewriteBase / is uncommented the site works if accessed by sub.domain.tld but if accessed by domain.tld/sub it again shows the directory structure :S
[edit]
I kept trying, even though I still don't really understand this, and was able to get it working. The end result is this
RewriteEngine On
#
RewriteCond %{HTTP_HOST} !^sfl\.
RewriteRule ^(.*)?$ http://sfl.example.com/$1 [L,R=301]
#
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
[end edit]
[edited by: jdMorgan at 2:21 pm (utc) on June 4, 2006]
[edit reason] No URLs, please. See TOS. [/edit]
by the way the above only works as intended if the / is pressent at the end of the dir name.
RewriteRule ^/*(.+/)?([^.]*[^/])$ [%{HTTP_HOST}...] [L,R=301]
is that the best way to fix the missing back slash?