简体   繁体   中英

Replacing GET variables names with slash

I have URL like http://www.blah.eu/cats/black_cats?age=over-10-years&sex=male and I would like to parse it into http://www.blah.eu/cats/black_cats/over-10-years/male without losing $_GET information (for PHP to be able to parse it, basically. My current .htaccess looks like

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) $1.php [L]

Is it in any way possible? Unfortunately I am not yet familiar with Apache servers.

将此行插入您要添加www的RewriteRule行的正下方。

RewriteRule ^(cats)/([^/]+)/([^/]+)/([^/]+)/?$ /$1/$2?age=$3&sex=$4 [L,QSA,NC]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM