我有一个脚本用于从url中删除.php,第二个用于传递用户名
# activate rewrite engine
RewriteEngine On
# WordPress rules
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# username in url
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /x/profile.php?username=$1
答案 0 :(得分:1)
超级简单,将它们全部合并到一个文件中:
RewriteEngine On
# Combined rules
RewriteRule ^(.*)$ /x/profile.php?username=$1
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]