1

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.

1 Answer 1

1

Insert this line just below RewriteRule line where you're adding www.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.