mardi 24 octobre 2017

.htaccess file not rewriting URL's correctly when project is in subdirectory

I currently have a problem with rewriting my URL's using the .htaccess file when a Laravel project is in a subdirectory.

usually when not in subdirectory having /vacancies -> /index.php/vacancies using this below .htcaccess file works.

<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine on

RewriteLog "/var/log/httpd/rewrite.log"
RewriteLogLevel 3

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^index.php [L]

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

Though now the project exists within a subdirectory I require the URL to be re written as so /vacancies -> /abc/index.php/vacancies.

The home page works correctly though any links just return a not found error.

What changes would I need to have the .htaccess file do this for me.

Thanks!




Aucun commentaire:

Enregistrer un commentaire