Php .htaccess重写更改url的规则
这是我当前的.htaccess:Php .htaccess重写更改url的规则,php,.htaccess,Php,.htaccess,这是我当前的.htaccess: Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?page=$1 [QSA,L] RewriteRule ^games/(.*)$ index.php?page=games&game=$1 [L,QSA] 我需要这样才
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1 [QSA,L]
RewriteRule ^games/(.*)$ index.php?page=games&game=$1 [L,QSA]
我需要这样才能工作:
index.php?page=音乐应该是url.com/music
index.php?page=游戏应该是url.com/games
php?page=games&game=example应该是url.com/games/example
请帮助我为此编写.htaccess请尝试以下操作
Options +FollowSymlinks
RewriteEngine on
rewriterule ^index.php?page=music(.*)$ http://otherdomain.com/music$1 [r=301,nc]
rewriterule ^index.php?page=music(.*)$ http://otherdomain.com/music$1 [r=301,nc]
rewriterule ^index.php?page=games(.*)$ http://otherdomain.com/games$1 [r=301,nc]
rewriterule ^index.php?page=games&game=example(.*)$ http://otherdomain.com/games/example$1 [r=301,nc]
你目前的规则有什么问题?他们不工作吗?他们做什么或不做什么?OP想要重写url,而不是重定向它们。