重定向如果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