XAMPP alias or rewrite?
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.
... 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]
Comments
Post a Comment