Cannot rewrite rule
-
Hi I’ve searched and tried all the solutions but nothing works at the moment. I am developing the site in a sub folder and wonder if that has anything to do with it.
I have a page set up at https://www.mywebsite.com/admin/where-to-eat-drink and I am trying to rewrite a rule so that various links that look like this
www.mywebsite.com/admin/where-to-eat-drink/raj_pavilion
go to that page and are broken down so the last part of the url can be used to return the correct data :
www.mywebsite.com/admin/where-to-eat-drink/&?var=raj_pavilion
In my .htaccess file I have tried this
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /admin/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /admin/index.php [L] RewriteRule ^where-to-eat-drink/(.*)$ where-to-eat-drink/?var=$1 [NC,QSA] </IfModule> # END WordPress
I’ve also tried adding a function in functions.php:
add_rewrite_rule('^where-to-eat-drink/([^/]+)/?','where-to-eat-drink?var=$matches[1]','top');
All I get is a 404 error
any ideas would be much apreciated.
Thanks
- The topic ‘Cannot rewrite rule’ is closed to new replies.