如果之前有人問過這個問題,我深表歉意,但我找不到我的問題的具體實體。
如何實作這一目標www.example.com/index.php?user=john,以www.example.com/john
我已經在使用它來洗掉.php擴展,但它沒有修復用戶引數。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.] )$ $1.php [NC,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R]
ErrorDocument 404 /error.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/([A-Za-z0-9_] ) ?user=$1
我非常重視任何回復。請幫忙。
uj5u.com熱心網友回復:
根據您顯示的嘗試,請嘗試遵循 htaccess 規則。考慮到您必須將引數傳遞給后端的 index.php 檔案。
還要確保在測驗 URL 之前清除瀏覽器快取。
RewriteEngine ON
##External redirect rules here.
RewriteCond %{THE_REQUEST} \s/index\.php\?user=(\S )\s [NC]
RewriteRule ^ /%1? [R=301,L]
##Internal rewrite rules here..
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/?$ index.php?user=$1 [QSA,L]
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/400168.html
