: Redirect to other folder but get URL appear the same I have a web app project located in a directory called issues with several sub directories. The folder structure is as follows: -issues
I have a web app project located in a directory called issues with several sub directories.
The folder structure is as follows:
-issues
-applications
-cli
-library
-public
-css
-js
index.php
If you point the url to the issue folder nothing happens. To load the website the URL needs to point to issues/public and then the site runs from there.
Is there a way to have the url point to just the issues directory but load the files as if it was in the issues/public directory?
Everything is linked in such a way in the application that it would be impossible to move the contents of the public folder to the issues folder.
I was looking at htaccess redirects and have so far managed to redirect issues to issues/public but this isn't ideal.
I did that using the following:
RewriteRule ^issues/?$ "/issues/public" [R=302,L]
More posts by @Jennifer507
2 Comments
Sorted by latest first Latest Oldest Best
Rewrites are what you're looking for as long as you don't redirect (the R flag):
# placed under root, ie /.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
# to prevent infinite redirection and 500 error:
RewriteCond %{REQUEST_URI} !^/issues/public
RewriteRule ^issues(/?$|/.*$) /issues/public [L]
</IfModule>
Aliases can act—sort of—similarly, but they're not the right tool for the job. They are more comparable to filesystem symlinks than URL-rewriting. Read more from a Stack Overflow answer.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.