Forum Moderators: phranque
How can i do that if i have a space between the word "My" and "Page"?
I've tried doing this:
RewriteRule ^My Page.htm$ [mysite.com...]
But didn't work.
So i've tryed this too:
RewriteRule ^My%20Page.htm$ [mysite.com...]
And nothing happens... anyone can help me?
But I was able to 301 redirect a file with a space in the filename by putting quotes around the filename. I'm by no means an apache expert, so be sure to test thoroughly as your results might differ on a different server. But try dropping this into your .htaccess file:
redirect 301 "/my page.htm" http://www.example.com/page.htm
Alternatively, I'm not sure exactly what your goals are for this redirect, but you could just put this between the <head> tags in "my page.htm":
<meta http-equiv="refresh" content="5;url=http://www.mysite.com/my_page.php">
redirect 301 "/my page.htm" [mysite.com...]
I've read some articles and some threads here about rewriting, but I haven't played around with it enough to really know it.
Thus, for example:
Redirect 301 /widgets_ http://www.example.com/products/widgets-
If an exact one-to-one redirect is desired, then a full URL-path should be specified, or RedirectMatch can be used instead.
I offered a RewriteRule solution on the basis of the original post asking about a RewriteRule; Either will work. The use of mod_rewrite or mod_alias for simple rewrites like this is largely a matter of personal preference.
Jim