PDA

View Full Version : 301 redirect not working



hawkwind dave
04-19-2011, 02:43 PM
Hi guys...

no idea what's wrong here... I've put a 301 redirect in the htacces file which is in the same folder as index



RedirectMatch 301 ^(.*)$ http://www.newdomain.com

obvoiusly I've relaced newdomain with my domain, but it's adding a /www/ folder after the domain once redirected

i.e. newdomain.com/www/


and the error is:

Not Found

The requested URL /www/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache mod_fcgid/2.3.6 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at www. newdomain .com Port 80

I'd like to get this sorted before the client sees it... any ideas why it's adding the /www/ to the end of the URL? Is it the wrong server for this type of redirect?

HTMLBasicTutor
04-19-2011, 05:28 PM
Did you just put that line that you showed us?

Should be for example:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^without www domain name$ [NC]
RewriteRule ^(.*)$ http://with www domain name/$1 [R=301,L]
Obviously you have to change the names of the domains in my example.

hawkwind dave
04-20-2011, 04:26 AM
Did you just put that line that you showed us?

Should be for example:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^without www domain name$ [NC]
RewriteRule ^(.*)$ http://with www domain name/$1 [R=301,L]
Obviously you have to change the names of the domains in my example.

thanks for your reply.

The code you've provided... isn't that for redirecting non www. to the www.domain?

I'm redirecting the old domain to their new domain but have never had this issue before. There does appear to be a few variations for a domain redirect in htaccess and have tried a few of them, all with the same result. Thanks again.

hawkwind dave
04-20-2011, 04:31 AM
got it working now... using:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.co.uk$ [NC]
RewriteRule .* http://www.newdomain.co.uk%{REQUEST_URI} [R=301,L]



:)