Hide category name using mod_rewrite
-
I have a website with at least 3 categories. I have set one of them as the default category.
Next step was that I need to have the category slug of the default category to be hidden from the URL slug, and the rest of the categories should be left untouched.
My current permalink structure is: /%category%/blog/%post-name%/
example: /en/blog/wordpress-post-sample/and I need it to be:
/blog/wordpress-post-sample/and the other categories should remain the same:
/fr/french-post-title/
/de/german-post-title/My current htaccess contents are as follows:
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.website\.com$ #RewriteRule ^blog/(.*)/?$ /en/blog/$1/ [L]
I have tried the above but when I visit /blog/wordpress-post-sample/, I get a 404 response.
Note: If I add R=301 tag, it correctly redirects the url back to /en/blog/ URL but no luck when R=301 is removed.
PS: I’d like to have a no-plugin solution.
Appreciate your help. Cheers
- The topic ‘Hide category name using mod_rewrite’ is closed to new replies.