homepage Welcome to WebmasterWorld Guest from 50.19.33.5
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
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?
htaccess
linjuming




msg:4547311
 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!

 

lucy24




msg:4547312
 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


Danger!
:: bzzzt ::
Danger!
:: 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 ;)

g1smd




msg:4547359
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved