我想使用我的.htaccess
文件来确保以下路由发生:
success_stories.php - > success_storie
这是我尝试过的,但它没有用,因为我得到了404。
Options -MultiViews +FollowSymLinks
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^success_stories.php$ /success_storie [L,R,NC]
答案 0 :(得分:1)
尝试类似的东西
## hide .php extension snippet
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]
# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]