简体   繁体   中英

Rewrite not working for mysite/index

I have the following .htaccess file in mysite/folder:

 RewriteEngine On

 RewriteCond %{REQUEST_FILENAME} -s [OR]
 RewriteCond %{REQUEST_FILENAME} -l [OR]
 RewriteCond %{REQUEST_FILENAME} -d

 RewriteRule ^.*$ - [NC,L]
 RewriteRule ^.*$ index.php [NC,L]

It's working for mysite/folder/anything, except for mysite/folder/index. The error given is "The requested URL /mysite/folder/index/ was not found on this server."

What I'm missing?

You need to take out 2nd rewrite rule from your code:

 RewriteEngine On

 RewriteCond %{REQUEST_FILENAME} -s [OR]
 RewriteCond %{REQUEST_FILENAME} -l [OR]
 RewriteCond %{REQUEST_FILENAME} -d

 RewriteRule ^.*$ index.php [L]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM