172 posts
  • Has been a member for 4-5 years
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Europe
  • Referred between 100 and 199 users
  • Bought between 10 and 49 items
ThemePrince says

Hello all,

I have a problem: I’d like to create custom permalink for the categories but leave the rest intact. For example:

mysite.com/?cat=1 will be mysite.com/house mysite.com/?cat=3 will be mysite.com/lands

AND the rest stays intact:

mysite.com/?p=123 mysite.com/?page_id=96

I tried some htaccess rewrite tutorials but no success yet…

Thanks!

172 posts
  • Has been a member for 4-5 years
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Europe
  • Referred between 100 and 199 users
  • Bought between 10 and 49 items
ThemePrince says

I solved it!

  • And I had to put these lines into the .htaccess file:
# BEGIN WordPress
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^houses$ ?cat=1 [L]
RewriteRule ^lands$ ?cat=3 [L]
# END WordPress
3365 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+4 more
sevenspark Volunteer moderator says

I solved it!
  • And I had to put these lines into the .htaccess file:
# BEGIN WordPress
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^houses$ ?cat=1 [L]
RewriteRule ^lands$ ?cat=3 [L]
# END WordPress

I believe you can accomplish this easily by going to Settings > Permalinks and under “Optional” > Category base just enter a dot (.)

I find that this works if the Custom Structure is set to /%category%/%postname%, but haven’t tested this for all permalink structures

EDIT : I realized this solution can screw up category archive paging, so your solution is probably better if it fixes that problem :)

by
by
by
by
by
by