199 posts ThemePrince
  • Weekly Top Seller
  • Elite Author
  • Exclusive Author
  • 5 Years of Membership
+3 more
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!

199 posts ThemePrince
  • Weekly Top Seller
  • Elite Author
  • Exclusive Author
  • 5 Years of Membership
+3 more
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
3535 posts
  • Power Elite Author
  • Author Level 12
  • Trendsetter
  • United States
+13 more
sevenspark
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