this exact .htaccess works on live server, but not on localhost (shows page with web structure), why?
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(css|js|icon|zip|rar|png|jpg|gif|pdf)$ /public/index.php [L]
This .htaccess works on both:
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(css|js|icon|zip|rar|png|jpg|gif|pdf)$ index.php [L]
I'm doing something wrong, but don't know what, please help me.
Is there a folder /public
on localhost
? It seems like this folder only exists on the live-system. Or eventually the DocumentRoot is different.
Anyway, the only difference I see:
/public/index.php
which is an absolute path from DocumentRoot
. --> /path/to/DocumentRoot/public/index.php
index.php
which should be a relative path from from DocumentRoot
. --> /path/to/DocumentRoot/index.php
Make sure you are rewriting to the correct location.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.