.htaccess URL 用一个查询字符串变量重写
.htaccess URL rewrite with one query string vars
我第一次尝试 URL 重写,我有以下 URLS 需要重写:
http://domain.com/hotels/index.php?ct=new delhi
我想要这个
http://domain.com/hotels/hotels-in-new delhi
RewriteEngine On
RewriteCond %{THE_REQUEST} ^GET\ /hotels/index\.php\?ct=(\S+) [NC]
RewriteRule ^ /hotels/hotels-in-%1? [R=301,L,B] # Use QSD flag is Apache 2.4 or later
RewriteRule ^hotels-in-(.*)$ index.php?ct= [L]
我第一次尝试 URL 重写,我有以下 URLS 需要重写:
http://domain.com/hotels/index.php?ct=new delhi
我想要这个
http://domain.com/hotels/hotels-in-new delhi
RewriteEngine On
RewriteCond %{THE_REQUEST} ^GET\ /hotels/index\.php\?ct=(\S+) [NC]
RewriteRule ^ /hotels/hotels-in-%1? [R=301,L,B] # Use QSD flag is Apache 2.4 or later
RewriteRule ^hotels-in-(.*)$ index.php?ct= [L]