.htaccess 在静态页面地址以外的其他页面地址上使用通配符

.htaccess 在静态页面地址以外的其他页面地址上使用通配符,.htaccess,mod-rewrite,wildcard,.htaccess,Mod Rewrite,Wildcard,我想使用通配符,以便允许任何页面地址。但是我想使用一些静态页面地址,比如用户登录、注册等等。我目前正在使用此方法,但正如我所料,它将尝试在每个页面地址上查找page.php # KONTO RewriteRule ^skapa-ett-konto$ account-create.php [L] RewriteRule ^logga-ut$ account-logout.php [L] # KONTO: Sidor som behöver laddas in genom jQuer

我想使用通配符,以便允许任何页面地址。但是我想使用一些静态页面地址,比如用户登录、注册等等。我目前正在使用此方法,但正如我所料,它将尝试在每个页面地址上查找
page.php

# KONTO
RewriteRule ^skapa-ett-konto$    account-create.php [L]
RewriteRule ^logga-ut$    account-logout.php [L]


# KONTO: Sidor som behöver laddas in genom jQuery/AJAX
RewriteRule ^slutfor-registreringen$    configurations/javascripts/ajax-form/account-create.php [L]
RewriteRule ^logga-in$    configurations/javascripts/ajax-form/account-login.php [L]



# --------------------------------------- #



# PROFIL
RewriteRule ^anvandare/([a-z0-9]+)$    profile.php?u=$1 [L]



# --------------------------------------- #



# ENSKILDA FILER
RewriteRule ^(.*)$    page.php?p=$1 [L]
我如何才能使so
RewriteRule
对静态页面地址以外的其他页面地址使用通配符


提前感谢。

如果所有其他地址都不是文件,您可以在
页面.php
规则前面加上前缀

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* page.php?p=$0 [L]

如果我理解正确,您希望从上一条规则中排除一些现有页面,如
login
registration
。排除它们的方法如下所示:

# ENSKILDA FILER
# Add other pages to exclude here
RewriteCond %{REQUEST_URI}  !(page\.php|login|registration)  [NC]
RewriteRule ^(.*)$    page.php?p=$1 [L]