Custom htaccess, rewrite being overwritten by redirect
-
I am trying to create ‘faux’ pages that all link to the homepage with associated variables in the GET data. For example:
https://mysite.com/img/IMGNAME/comment/5678/
provide data like:
https://mysite.com/?image=IMGNAME&comms=5678I have the following in my htaccess file:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^img/([^/]+)/comment/([^/]+) /?image=$1&comms=$2 [L,NS] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
the issue is that i have a post that has a slug of IMGNAME (this is how im finding the post given the GET variable on the homepage).
When I manually enter https://mysite.com/?image=IMGNAME&comms=5678 it all works great.
When I enter https://mysite.com/img/IMGNAME/comment/5678/ I am redirected to (the url address changes AND it renders the single.php template) https://mysite.com/category/IMGNAME/
I am assuming index.php (or ‘/’) then gets processed by wordpress, in which it attempts to find the post with the closest name to the content of the variable im handing it and REDIRECTS to the post?
Does anyone know how to have the entered url STAY in the address bar and allow the homepage to process the GET variables?
- The topic ‘Custom htaccess, rewrite being overwritten by redirect’ is closed to new replies.