Jason Gugg
Jason Gugg

Reputation: 35

query Redirect issue with wordpress

I am trying to setup a query redirect for my category pages

Currently the url is as follows:

  http://chunkydeals.com/daily-deals/?category=alldeals

I am trying to get it to be something like:

  http://chunkydeals.com/daily-deals/alldeals/

my htaccess code is as follows:

  # BEGIN WordPress

  <IfModule mod_rewrite.c>

  RewriteEngine On

  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  RewriteCond %{QUERY_STRING} ^category=([a-z])*)$
  RewriteRule ^daily-deals/$ http://chunkydeals.com/daily-deals/%3/? [R=301,L]

  </IfModule>

  # END WordPress

Any help would be appreciated

Upvotes: 0

Views: 134

Answers (1)

Jon Lin
Jon Lin

Reputation: 143886

Have you tried putting the QUERY_STRING rules above the one that rewrites to index.php? (which prevents the regex ^daily-deals/$ from matching)

RewriteBase /

RewriteCond %{QUERY_STRING} ^category=([a-z])*)$
RewriteRule ^daily-deals/$ http://chunkydeals.com/daily-deals/%1/? [R=301,L]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Upvotes: 1

Related Questions