如何在 .htaccess 中重写 URL,这里有什么问题
How to rewrite URL in .htaccess, whats wrong here
认为用户输入
localhost/app/public/anything/anything/index/php/id/5
然后id喜欢改成
localhost/app/public/index.php?id=5
我写的表情是这样
RewriteRule ^index/php/id/([0-9]+)$ http://localhost/saecms/public/index.php?id= [L]
但是它不起作用,这里有什么问题吗?谢谢
您可以在 /app/public/.htaccess
文件中使用此规则:
RewriteEngine On
RewriteBase /app/public/
RewriteRule (?:^|/)index.php/id/(\d+)/?$ index.php?id= [L,QSA,NC]
认为用户输入
localhost/app/public/anything/anything/index/php/id/5
然后id喜欢改成
localhost/app/public/index.php?id=5
我写的表情是这样
RewriteRule ^index/php/id/([0-9]+)$ http://localhost/saecms/public/index.php?id= [L]
但是它不起作用,这里有什么问题吗?谢谢
您可以在 /app/public/.htaccess
文件中使用此规则:
RewriteEngine On
RewriteBase /app/public/
RewriteRule (?:^|/)index.php/id/(\d+)/?$ index.php?id= [L,QSA,NC]