can't rewriterule to a pretty permalink
-
Hi I’ve got a problem with trying to apply a rewriterule to a pretty permalink. I’m sure it must be simple but I’ve been searching all day with no solution. Here is my current standard wordpress default rewrites:
# 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] </IfModule> # END WordPress
I want to have a link such as https://www.mydomain.com/client1/brochure/
and I want it to rewrite so that it goes to: https://www.mydomain.com/client-work/?id=client1&work=brochure and keeping the original link https://www.mydomain.com/client1/brochure/ in the address bar.I have tried:
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /client-work/?id=$1&work=$2 [L]
and this does keep the https://www.mydomain.com/client1/brochure/ in the address bar however i get a sorry page not found error.I have tried:
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /client-work?id=$1&work=$2 [L]
which is the same as the first example but without the forward slash after client-work. This goes to the right permalink page – great! However in the address bar it now looks like: https://www.mydomain.com/client-work/?id=client1&work=brochure. Isn’t this redirecting as opposed to rewriting?I guess this is ok but when I do rewriteRules on non wordpress sites I can keep the nice url in the address bar.
Any help would be greatly appreciated. Thanks
- The topic ‘can't rewriterule to a pretty permalink’ is closed to new replies.