简体   繁体   中英

Apache Rewrite Rule server config troubles

Trying to figure out how to rewrite the following in server.conf. Any help would be greatly appreciated. Have been at this for a couple hours now and can't seem to get it to work.

www.maindomain.com/##### from a url that looks like wwww.maindomain.com/?id=##### where # signs are numbers.

I have tried all types of scenario's. Here are some that I have tried

  1. RewriteRule ^(.*)$ /?Id=$1{QUERY_STRING} [PT]
  2. RewriteRule ^(.*/)$ /?Id=$1{QUERY_STRING} [PT]
  3. RewriteRule ^(/.*)$ /?Id=$1{QUERY_STRING} [PT]
  4. RewriteRule ^/(.*)$ /?Id=$1{QUERY_STRING} [PT]

This should work (not tested): Change index.php to your home page file.

RewriteRule ^/?([\d]+) index.php?Id=$1 [QSA,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM