IIS URL Rewrite ASP

If you want to use regular expressions you could do something like this <rule name=”RewriteUserFriendlyURL1″ stopProcessing=”true”> <match url=”^([^/]+)/([^/]+)/?$” /> <conditions> <add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” /> <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” /> </conditions> <action type=”Rewrite” url=”default.asp?language={R:1}&amp;id={R:2}” /> </rule> This would rewrite “domain.com/en/service” as “domain.com/default.asp?language=en&id=Service”, or “domain.com/2/3” as “domain.com/default.asp?language=2&id=3” To change the 2 to en and the 3 … Read more

SEO Friendly URL

I’m not sure why people are being so deliberately obtuse here… What you are looking for is mod_rewrite, an apache module for URL rewriting. In your .htaccess file (you might need to make it) put: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^blog\/([0-9]+)\/.*$ /blog.php?post=$1 [L] </IfModule> This means when you go to /blog/10/any-old-bit-of-text/ behind the scenes it … Read more

htaccess code to remove extension AND add+force trailing slash?

Try this: RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php RewriteRule (.*)\.php$ /$1/ [L,R=301] RewriteRule (.*)/$ $1.php [L] The first rule redirects requests of /foo/bar.php externally to /foo/bar/. And the second rule rewrites requests of /foo/bar/ internally to /foo/bar.php. And to force the trailing slash, try this rule: RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule .*[^/]$ $0/ [L,R=301]