Note that there are some explanatory texts on larger screens.

plurals
  1. PO.htaccess remove index.php and others from url
    text
    copied!<p>I have a problem whereby google has indexed some pages with the wrong url.</p> <p>The url they are indexing is:</p> <pre><code>1. http://www.mydomain.com/index.php?a=profile&amp;u=john 2. http://www.mydomain.com/index.php?a=page&amp;b=about 3. http://www.mydomain.com/index.php?a=settings&amp;b=avatar 4. http://www.mydomain.com/index.php?a=feed 5. http://www.mydomain.com/index.php?a=feed&amp;filter=picture 6. http://www.mydomain.com/index.php?a=post&amp;m=32 7. http://www.mydomain.com/index.php?lang=english 8. http://www.mydomain.com/index.php?a=messages&amp;u=john&amp;id=4 9. http://www.mydomain.com/index.php?a=feed&amp;logout=1 </code></pre> <p>I need it to redirect to:</p> <pre><code>1. http://www.mydomain.com/john or http://www.mydomain.com/profile/john 2. http://www.mydomain.com/about or http://www.mydomain.com/page/about 3. http://www.mydomain.com/settings/avatar 4. http://www.mydomain.com/feed 5. http://www.mydomain.com/feed/picture or http://www.mydomain.com/feed/filter/picture 6. http://www.mydomain.com/message/32 7. http://www.mydomain.com/lang/english 8. http://www.mydomain.com/messages/john 9. http://www.mydomain.com/logout or http://www.mydomain.com/feed/logout </code></pre> <p>.htaccess isn't my forte, so any help would be much appreciated.</p> <p>Thanks in advance.</p> <p>Edit: </p> <ol> <li><p>Ok, I got it working by using two method by Dan Trimper and Jon Lin. First I'm generate mod rewrite url by using Dan Trimper method. For example <code>http://www.mydomain.com/index.php?a=page&amp;b=about</code>, so after generate it will produce the url like this <code>RewriteRule ^([^/]*)/([^/]*)$ /index.php?a=$1&amp;b=$2 [L]</code></p></li> <li><p>Second, after generate I'm using second method redirect url to <code>http://www.mydomain.com/page/about</code> by using Jon Lin method: </p> <p>RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.php\?a=page&amp;b=([^&amp;\ ]+) RewriteRule ^ /page/%1? [L,R=301]</p></li> <li><p>Thank you!</p></li> </ol> <p>Edit 2: Not working above because conflict. More accurate solution goes to this topic <a href="https://stackoverflow.com/questions/12538466/htaccess-friendly-url">.htaccess friendly URl</a></p>
 

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