0

我有一个用于从 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
4

1 回答 1

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]
于 2013-03-03T21:47:26.083 回答