重定向如果url包含特定单词而不更改它。重定向如果url包含单词而不更改url使用htaccess
如:http://localhost/APIs/student
应该重定向到“http://localhost/APIs/”
我试过很多东西波纹管给他们的一个:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^[A-Z]{10,}\s/+index\.php\?page=([^\s&]+) [NC]
RewriteRule^/%1? [R=301,L]
RewriteRule ^([a-z0-9-]+)/?$ /APIs/index.php?page=$1-10 [QSA,L,NC]
,如果我在通过多个参数上面的代码中失败链接后斜杠。
提供更多信息。 – hjpotter92
如果我通过“http:// localhost/APIs/student/dd/dd”,它会重定向到404页面。我想,如果有的话。参数在API中传递后,它应该重定向到index.php – Prerna
“.htaccess”文件位于何处? – hjpotter92