I need to redirect an URL with a variable, eg.
http://www.mydomain.com/foo/55555 should go to http://www.mydomain.com/bar/55555 where 55555 is a variable number.
Do I need to use redirect or rewrite?
I need to redirect an URL with a variable, eg.
http://www.mydomain.com/foo/55555 should go to http://www.mydomain.com/bar/55555 where 55555 is a variable number.
Do I need to use redirect or rewrite?
here's a RewriteRule that implements the redirect ([R])
RewriteRule ^/foo/([0-9]*)$ /bar?q=$1 [R]
if you are using .htaccess to add your rewrite rules, you might want to make this local to the /foo directory, so put the following into foo/.htaccess:
RewriteRule ^([0-9]*)$ /bar&q=$1 [R]
RewriteRule http://www.mydomain.com/foo/([0-9]*)$ http://www.mydomain.com/bar?q=$1 [R=301] but don't work
[04/Mar/2015:10:55:10 +0100] "GET /foo/55555 HTTP/1.1" 404 1441 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36" The rule is in .htaccess