.htaccess RewriteRule to include post type and taxonomy

Question

I’m trying to rewrite this url www.domain.com/gallery/?university=birmingham to an seo friendly one like this www.domain.com/uni/birmingham/gallery

the (?university=birmingham) represent the taxonomy
and gallery is the post type. At the moment this url (www.domain.com/gallery/?university=birmingham) works fine, it displays the right posts, just haven’t had any success in rewriting it to the one above

I have tried doing this (which should work):

RewriteEngine On
RewriteRule ^uni/([0-9A-Za-z_-]+)/(.+)$ /$2?university=$1 [QSA,NC,L,R=302]


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /students/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /students/index.php [L]


</IfModule>

can anyone please point me in the right direction or show me what am doing wrong?

0
, Gunther 3 years 2020-06-05T21:10:23-05:00 0 Answers 100 views 0

Leave an answer

Browse
Browse