Created apache alias directory, but not working
Solution 1
Why Wamp Server doesn’t do this automatically, I’m not sure, but at least there’s a simple fix.
Click on the Wamp Server icon again and select Apache -> Alias directories -> [alias url] -> Edit alias. This will open the alias file in Notepad. Remove the trailing slash from the relative URL.
For Example
Alias /example/ "c:/path/to/example/"
Would become
Alias /example "c:/path/to/example/"
Save the file and close Notepad.
Wamp Server should restart automatically (if not, do it manually). Once it has restarted, you’re alias should now work with or without the trailing slash.
Solution 2
Add a mod rewrite rule:
RewriteEngine On
RewriteRule /aa /aa/
user1126720
Updated on June 14, 2022Comments
-
user1126720 almost 2 years
I have created an apache alias directory so that I can access the directory from outside the root folder with the same url...
The problem is that it refuse to work without a trailing slash. As an example if the site name is
- www.example.com/aa
error Cannot find server appears.
However if I enter
- www.example.com/aa/
it works.
Any Idea how to fix this issue?
-
user1126720 over 12 yearsThanks for the help, by the way I implemented the answer given by @Rajat Singhal..and it worked...:)
-
hakre over 12 yearsOkay, cool, good to know. Might need to check my htconf now ;)
-
Cihad Turhan almost 12 yearsOh god I can't believe that. I wasted 3 hours for nothing. Thanks mate.
-
Daniel Marschall almost 10 yearsFor some reason, this did not work for me :-( Calling localhost/example showed the directory listing, but if I click on a link, I will be redirected to localhost/link instead of localhost/example/link . Actually there should be a 301 redirect from /example to /example/