我在我的網站中重寫URL時遇到問題。我設法從我的URL中刪除所有.php擴展名,並將所有mydomain.com/img?id=X重寫爲mydomain.com/img/X,但我一直在努力爭取一段時間,我會很感激幫幫我。我的網站由許多頁面組成,頁面X的鏈接是mydomain.com/?page=X(例如mydomain /?page = 3),但我想將該網址改寫爲mydomain.com/page/X在.htacess中重寫頁碼
這裏是我的.htaccess:
RewriteEngine on
RewriteBase/
<nothing important>
RewriteCond %{HTTP_HOST}//s%{HTTPS} ^www\.(.*)//((s)on|s.*)$ [NC]
RewriteRule^http%3://%1%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^img/([0-9]+)/?$ img.php?id=$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
的[在index.php文件重寫]可能的複製(HTTP://計算器.com/questions/34503009/rewrite-in-index-php) –