RewriteRule ASP.NET Tutorial

The RewriteRule in htaccess looks like this in C#

RewriteRule ^match-site-url$  redirect-to-this


RewriteRule ^*/d$ /test.php?id=$1&id2=$2

This will match the following patterns
and the page will be send to test.php that is sitting in the root directory. 1234 is the first match located by d* and will be passed in the query string as test.php?id=1234.
1234 is followed by “/”. Since this is just static text (not a pattern) and thefefore will not be hold in any variable.
After this comes another integer, 5678. This will be catched by the second d*. Since this is the second regex expression, it will be held in variable$2. This string is passed to the query in this form

The complete redirect, takes this form

^$ #pattern
This entry was posted in Tutorials/Tips. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s