Mobile app version of vmapp.org
Login or Join
Jennifer507

: 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

@Jennifer507

Posted in: #Redirects #UrlRewriting

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]

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Jennifer507

2 Comments

Sorted by latest first Latest Oldest Best

 

@Frith620

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.

10% popularity Vote Up Vote Down


 

@Jamie184

With a redirect you'll always be redirecting the user to another location, thus changing the url. Therefore you would probably want to use mod_alias instead of mod_rewrite.

Alias /issues /absolute/filesystem/path/to/issues/public

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme