Pri*_*ime 6 php regex apache .htaccess mod-rewrite
I have been working on localhost, and my htaccess file is
Options +FollowSymLinks
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]
Run Code Online (Sandbox Code Playgroud)
after adding the htacces code,the url
localhost/movies/news.php
Run Code Online (Sandbox Code Playgroud)
works
localhost/movies/news
Run Code Online (Sandbox Code Playgroud)
also works but
localhost/movies/news/
Run Code Online (Sandbox Code Playgroud)
不起作用.它显示"内部服务器错误".如何使用斜杠和没有斜杠.
你试试这个代码:
Options +FollowSymLinks -MultiViews
RewriteEngine On
# Internally forwards movies/news/ to movies/news.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
Run Code Online (Sandbox Code Playgroud)