194 posts ThemePrince
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has sold $75,000+ on Envato Market and is now an Elite Author
+2 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!

194 posts ThemePrince
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has sold $75,000+ on Envato Market and is now an Elite Author
+2 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
3503 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 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 :)

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by