homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

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

Msg#: 4547309 posted 4:27 am on Feb 21, 2013 (gmt 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!



WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

Msg#: 4547309 posted 4:47 am on Feb 21, 2013 (gmt 0)

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 ;)


WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4547309 posted 10:07 am on Feb 21, 2013 (gmt 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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved