Bradley W. Myers
Bradley W. Myers

Reputation: 61

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]

Upvotes: 1

Views: 86

Answers (1)

Example person
Example person

Reputation: 3346

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

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

Upvotes: 1

Related Questions