Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
555 views
in Q2A Core by

So, we have:

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>

Which works great, thank you for this. Now, let's say we want to add some other simple, one-off redirects for marketing/affiliate purposes, adding:

redirect /fun-stuff/ http://somethingoffsite.com/whatever/

What URL we end up on after the redirect is something like:

http://somethingoffsite.com/?qa-rewrite=whatever/

Not only is this not pretty, but can break tracking for URLs with marketing/affiliate purposes. Of course, this makes sense considering the initial rewrite rules, but how do we avoid this, what's the workaround? I've tried quite a few different tricks, all ending in failure.

Thank you.

Q2A version: 1.7

1 Answer

+1 vote
by

DirectoryIndex index.php 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase / 
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ 
RewriteRule . %1/%2 [R=301,L] 
RewriteCond %{HTTP_HOST} ^ans\.bissoy\.com$ [NC] 
RewriteRule ^(.*)$ http://www.ans.bissoy.com/$1 [R=301,L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L] 
</IfModule>

I use this code on my site and it works. smiley

...