htaccess只忽略一条重写规则

时间:2014-04-07 11:05:08

标签: php .htaccess mod-rewrite

在我的htaccess文件中,我已经定义了一些规则,除了一个规则之外,它们都正在工作。

html链接

<a href="Games-name-of-game">Name of game</a>

Htaccess是

RewriteRule ^Games-([^/]*)$ /gameDescription.php?games=$1 [NC]

当我点击上面的链接时,它会将游戏名称重定向到/gameDescription.php?games=name-of-game

除此之外,所有其他规则[重定向]工作正常。

我的Htaccess

Options All -Indexes

<files .htaccess>
order allow,deny
deny from all
</files>

RewriteEngine on
RewriteCond %{ENV:REDIRECT_STATUS} ^$

RewriteRule ^Games-([^/]*)$ /gameDescription.php?game=$1 [NC]
RewriteRule ^Home$ /index.php [NC]
RewriteRule ^Games$ /games.php [NC]
RewriteRule ^News$ /news.php [NC]
RewriteRule ^Videos$ /videos.php [NC]
RewriteRule ^Contact$ /contact.php [NC]
RewriteRule ^About$ /about.php [NC]
RewriteRule ^Privacy$ /privacy.php [NC]
RewriteRule ^Ideas$ /gameDesign.php [NC]
RewriteRule ^Profile$ /profile.php [NC]

RewriteRule ^Search/Query/([^/]*)$ /search.php?query=$1 [NC]

1 个答案:

答案 0 :(得分:0)

已修复 - 从规则中移除了单词游戏,一切正常运作

这是我更新的htaccess

Options All -Indexes

<files .htaccess>
order allow,deny
deny from all
</files>

RewriteEngine on
RewriteCond %{ENV:REDIRECT_STATUS} ^$

RewriteRule ^Home$ /index.php [NC]
RewriteRule ^Games$ /games.php [NC,L]
RewriteRule ^News$ /news.php [NC]
RewriteRule ^Videos$ /videos.php [NC]
RewriteRule ^Contact$ /contact.php [NC]
RewriteRule ^About$ /about.php [NC]
RewriteRule ^Privacy$ /privacy.php [NC]
RewriteRule ^Ideas$ /gameDesign.php [NC]
RewriteRule ^Profile$ /profile.php [NC]

RewriteRule ^Title-([^/]*)$ /desc.php?game=$1 [NC]

RewriteRule ^Search/Query/([^/]*)$ /search.php?query=$1 [NC]