Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

how to rewite index.php?main page=xxx in htaccess?


4:27 am on Feb 21, 2013 (gmt 0)

New User

joined:Feb 21, 2013
votes: 0

RewriteEngine On
RewriteRule ...

/* ------- for example ------- */
www.laji.com/xxx => www.laji.com/index.php?main_page=xxx
www.laji.com/xxx/ => www.laji.com/index.php?main_page=xxx

xxx can be [a-zA-Z\d] and "-" , can not be "xx.php"
I am not good at htaccess.some people helps ?
thank you very much!
4:47 am on Feb 21, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
votes: 403

www.laji.com/xxx => www.laji.com/index.php?main_page=xxx
www.laji.com/xxx/ => www.laji.com/index.php?main_page=xxx

:: bzzzt ::
:: bzzt ::
Duplicate Content alert!
:: bzzt bzzt bzzt ::

Let's see what your best try looks like. (See boilerplate on Why We Make You Do It Yourself*) Don't forget the preceding rule that issues an explicit redirect-- not rewrite-- to people who ask for the ?querystring version by name.

* I can't re-post it too often or this forum will itself start falling prey to Duplicate Content ;)
10:07 am on Feb 21, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
votes: 0

You should have one rule that redirects request with slash to new URL without. This fixes the Duplicate Content problem that you wanted to create for your site. This Rule will also have a preceding Condition that checks THE_REQUEST.

Your site should link to URLs that do not end with a slash.

The second rule is the rewrite and is just one line of code.

As the most asked question here, there's a couple of thousand previous threads with the code. The last time we went through this all was just a few days ago.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members