Quantcast htaccess redirects on Apache Text - Physics Forums Library

PDA

View Full Version : htaccess redirects on Apache


CRGreathouse
Sep5-08, 04:01 PM
I'm running an Apache server, but I'm having trouble redirecting files. I've tried including lines like

Redirect permanent /oes.htm https://example.com/file.html

in the httpd.conf file as well as in an .htaccess file, but loading the URL in the browser I only get the original file, not the file I'm redirecting to. Neither of

Redirect /oes.htm https://example.com/file.html
Redirect 301 /oes.htm https://example.com/file.html

work (though all three should be the same, I think, unless Redirect gives a 302 instead).


I'm including alias_module already:
LoadModule alias_module modules/mod_alias.so

What am I doing wrong? Is there something else I need to configure?

Greg Bernhardt
Sep5-08, 04:08 PM
Here is an example of what PF does for it's blogs. Top of the htaccess file.

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.physicsforums.com/blog.php$1 [R=301,L]

CaptainQuasar
Sep29-08, 08:23 PM
I remember that getting the Redirect directive to work was a pain in the butt, and I ended up having to use RedirectMatch instead, but I don't remember exactly why... try this instead maybe?
RedirectMatch \/oes.htm$ https://example.com/file.html
The first parameter is a regex, of course, with the slash escaped and "$" signifying end-of-string.⚛