I have a site running on W2012 with XAMPP. I have a live site that was in subfolder /foo. It now needs to be changed to /home.

I set up an alias 

Alias /foo "C:/xampp/htdocs/home"

This takes users from foo-->home... however they lose the page that they were going to. The problem is a lot of the pages on foo were privately given so we would be expecting users to understand that they need to copy their page to the new url. I need a user going to foo/client-demo to go automatically to home/client-demo.

Addition: Yesterday I set up a redirect.

Redirect foo/client-demo home/client-demo

This works. Then I thought that the reason the Alias isn't working is my SSO. I have an SSO SAML login script that redirects the user the their entry page. So if the user starts at foo/xyz the alias kicks them to home/xyz (maybe on the xyz) and then they hit the login script and go back to their referral page.

1 Answer 1


... however they lose the page that they were going to.

I'm not sure what you mean by this - they shouldn't "lose" anything? However, the URL in the address bar will not be updated - if that is what you are implying? An Apache Alias converts a URL to a server-side filesystem path (usually to allow access to files located outside of the document root) - it does not manipulate the URL.

It sounds like you want an external redirect (301 - permanent). For example, using mod_alias (prefix matching):

Redirect 301 /foo /home

This assumes that you are not already using mod_rewrite to process redirects/rewrites (such as with WordPress). If you are already using mod_rewrite for this purpose then you must also use mod_rewrite for this redirect, since the order of execution might not be as expected. For example:

RewriteRule ^/?foo(.*) /home$1 [R=301,L]
  • I tried the redirect also and it does the same thing. It does work if I set a redirect for a single page - see my update.
    – blankip
    Jun 8, 2015 at 17:58
  • Not sure why it would work for a single URL and not as a general redirect. Just to clarify, an Alias and a "redirect" are two very different things, so ordinarily you should not get "the same thing" - unless there is something else going on. I assume these directives are going in your Apache config? The "redirect" you have posted in your question is not correct (and would result in an error) - you are missing a slash prefix. (?) I'm not familiar with SSO SAML unfortunately, but you should be able to see what is going on by monitoring the network traffic in your browser.
    – DocRoot
    Jun 8, 2015 at 19:28
  • Do you have any other directives on your virtual host? Any .htaccess files?
    – DocRoot
    Jun 8, 2015 at 19:30
  • I just have the basic WP directory rewrite info in my htaccess files. The redirect I have above works fine too - I know you are supposed to use windows path but it works... The alias has me stumped. I am mainly an IIS guy but have set up plenty of apache servers too - not sure if I had to do a wildcard redirect before (that's what we would call this in IIS).
    – blankip
    Jun 9, 2015 at 18:45
  • The "WP directory rewrite" could be a problem (which is why I mentioned that the use of Redirect (mod_alias) is assuming you are not already using mod_rewrite). In this case you should redirect using RewriteRule (mod_rewrite) - I'll update my answer - since the order of execution might not be as expected. "you are supposed to use windows path but it works" - what do you mean by "windows path"?
    – DocRoot
    Jun 9, 2015 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.