Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Htaccess redirects on Apache

  1. Sep 5, 2008 #1


    User Avatar
    Science Advisor
    Homework Helper

    I'm running an Apache server, but I'm having trouble redirecting files. I've tried including lines like

    Code (Text):
    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

    Code (Text):
    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:
    Code (Text):
    LoadModule alias_module modules/mod_alias.so
    What am I doing wrong? Is there something else I need to configure?
  2. jcsd
  3. Sep 5, 2008 #2
    Here is an example of what PF does for it's blogs. Top of the htaccess file.

    Code (Text):
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) https://www.physicsforums.com/blog.php$1 [R=301,L]
  4. Sep 29, 2008 #3
    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?
    Code (Text):
    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.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Htaccess redirects on Apache
  1. Apache error webpage (Replies: 4)

  2. Forbidden apache error (Replies: 3)

  3. Apache Virtual Host (Replies: 2)