Note that there are some explanatory texts on larger screens.

plurals
  1. PO.htaccess redirect non existing pages based on index.php page with wildcard and something after it to index.php
    primarykey
    data
    text
    <p>Please help, some website is arbitrarily adding dynamic query strings to my home page.</p> <p>For example my home page is www.mysite.com/index.php and they link to many links like this:</p> <pre><code>www.mysite.com/index.php?a=something-something-something www.mysite.com/index.php?a=something-other www.mysite.com/index.php?a=some-other-thing </code></pre> <p>And those links are opening on my site, content of page are the same for every page, just like my original www.mysite.com/index.php</p> <p>There are few hundreds of that links pointing to my site. So how I can redirect this:</p> <pre><code>www.mysite.com/index.php?a=something-something-something www.mysite.com/index.php?a=something-other www.mysite.com/index.php?a=some-other-thing ... </code></pre> <p>to</p> <p><code>www.mysite.com/index.php</code> or just to <code>www.mysite.com/</code></p> <p>This what I tried so far in my .htaccess file</p> <pre><code>RedirectMatch 302 ^index.php?a= http://www.www.example-ste.com/ RewriteRule ^/index.php?a=(.*) http://www.example-ste.com/ </code></pre> <p>But still pages are opening on site.</p> <hr> <p><strong>Another similar question.</strong></p> <p>How to redirect pages ending with "<strong>?pagewanted=all</strong>" to the same page but with out that <strong>"?pagewanted=all"</strong></p> <p>For example I need to redirect page:</p> <p><strong>www.mysite.com/something-something/something.html?pagewanted=all</strong></p> <p>to</p> <p><strong>www.mysite.com/something-something/something.html</strong></p> <hr> <p>Hello.</p> <p>I just noticed something. I needed URL redirection rule which will redirect pages like:</p> <pre><code>www.mysite.com/index.php?a=something-something-something www.mysite.com/index.php?a=something-other www.mysite.com/index.php?a=some-other-thing </code></pre> <p>to home page of site, root. And you gave me this code:</p> <pre><code>RewriteEngine On RewriteBase / #if the query string has an a parameter RewriteCond %{QUERY_STRING} (^|&amp;)a= [NC] #Redirect and remove query string parameters RewriteRule .* http://www.mysite.com/? [R=301,L] </code></pre> <p>And I must say it works fine, it does that, but I just noticed that it somehow blocks or redirect all links containing <code>?a=</code> for example on some temporary pages I have links like:</p> <pre><code>i.php?a=something-something-something </code></pre> <p>So, can you adopt code just for pages based on index.php like:</p> <pre><code>www.mysite.com/index.php?a=something-something-something </code></pre> <p>and not for links with:</p> <pre><code>i.php?a=something-something-something </code></pre> <p>If I am right it works on all links with "<code>a=</code>" but I need just for "<code>index.php?a=</code>"</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload