Forum Moderators: phranque
I currently have
www.mysite.com/forums/showthread.php?&threadid=259
and I need this to got to
www.mynewsite.com/showthread.php?&threadid=259
Can someone please let me know the syntax for this...also which directory should the htaccess file be uploaded into the root or the /forums/ directory..
Thanks
This .htaccess might do what you are after and belongs in the root of your site.
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST}!^www\.mynewsite\.com
RewriteRule ^(.*)$ [mynewsite.com...] [R=permanent,L]
Let's know the outcome as I am still learning from some of the eXpert teachers on here :)
HTH,
-gs
Before I try this can I just say that I only want redirects from the www.mysite/forums/ directory to be redirected.
the rest of my site should not change.
Basically I have moved my forums to a new domain and I want to redirect all www.mysite.com/forums/ to the new site nothing underneath
So
www.mysite.com should stay on www.mysite.com
and
www.mysite.com/forums/ should go to www.mynewsite.com/
This is the response I get from the above code...
Hello 195.92.109.226(195.92.109.226)
A 500 error occurred when I tried to retrieve [mysite.com...] for you. This means Internal Server Error.
I tried to access the following URL
[mysite.com...]
Any ideas...
Thankyou
Common Problems with 500 Server Error
Many times people report a "500 Server Error" when creating/modifying their .htaccess or .htgroup files. Nine out of ten times this is caused by one of two things. 1) The file was transferred to the server using FTP in Binary mode rather than ASCII. 2) There is no "new-line" or "carriage return" on the last line of the file. This too can be caused by transferring the file in Binary mode. Please re-transfer the file using FTP ensuring that you are transferring it in ASCII mode.
-gs
My current .htaccess that I have set up works like this:
Redirect 301 /forums/ [mynewsite.com...]
This works a charm but doesn't append the individual pages for me.
Assuming that you have only got one site (the old one) pointed to this home directory (and perhaps depending on other things) I reckon this should work (in the root directory):
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^forums\/(.*)$ http://www.mynewsite.com/$1 [R=301,L]
Failing that, wait for jdmorgan to post... :)
Also, be warned: if you have the type of host that does not display .htaccess files in windows clients such as WSFTP it is possible that you have accidentally loaded an .htaccess into a sub-directory. This can wreak havoc (and 500s)! Loading an empty .htaccess is not a good option - you'll have to get in with native ftp and delete the dud files.
[edit - just realised on posting the above is identical to 'closed's' post - the only difference being the relative directory - you get the gist anyway - depends on if you want one .htacess for the site or one for each major directory]