IIS URL Rewrite and Web.config

I don’t understand anything about IIS, but am trying to solve this problem of redirecting all visitors to domain.com/page to domain.com/page.html <?xml version=”1.0″ encoding=”utf-8″ ?> <configuration> <system.webServer> <rewrite> <rewriteMaps> <rewriteMap name=”StaticRedirects”> <add key=”/page” value=”/page.html” /> </rewriteMap> </rewriteMaps> </rewrite> </system.webServer> </configuration> A couple of problems arise: I don’t know where to even put the file. There … Read more

urlencoded Forward slash is breaking URL

About the system I have URLs of this format in my project:- http://project_name/browse_by_exam/type/tutor_search/keyword/class/new_search/1/search_exam/0/search_subject/0 Where keyword/class pair means search with “class” keyword. I have a common index.php file which executes for every module in the project. There is only a rewrite rule to remove the index.php from URL:- RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} … Read more

.htaccess rewrite subdomain to directory

Is it possible to use .htaccess to rewrite a sub domain to a directory? Example: http://sub.domain.com/ shows the content of http://domain.com/subdomains/sub/ Answer Try putting this in your .htaccess file: RewriteEngine on RewriteCond %{HTTP_HOST} ^sub.domain.com RewriteRule ^(.*)$ /subdomains/sub/$1 [L,NC,QSA] For a more general rule (that works with any subdomain, not just sub) replace the last two … Read more

IIS URL Rewrite {R:N} clarification

I’ve not been able to understand the purpose of {R:N}. Could anyone please clarify when to use {R:0} vs. {R:1} usage example: <action type=”Redirect” url=”http://www.{HTTP_HOST}/{R:0}” /> I’ve seen ScottGu using {R:1} http://weblogs.asp.net/scottgu/archive/2010/04/20/tip-trick-fix-common-seo-problems-using-the-url-rewrite-extension.aspx Whereas, below has {R:0} http://weblogs.asp.net/owscott/archive/2009/11/27/iis-url-rewrite-rewriting-non-www-to-www.aspx Had a look at the IIS link below but could not quite digest the definition below: Back-references to … Read more

How to remove “index.php” in codeigniter’s path

How do I remove the “index.php” sticking out in every path in codeigniter somewhere in the center? I want clean non index.php-fied URLs? Answer If you are using Apache place a .htaccess file in your root web directory containing the following: RewriteEngine on RewriteCond $1 !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt) RewriteRule ^(.*)$ … Read more

How to check whether mod_rewrite is enable on server?

Currently I am using the hosting with lightspeed server. Hosting says mod_rewrite is enabled but I can’t get my script working there. Whenever I try to access the URL, it returns 404 – not found page. I put the same codes at another server which is running with Apache. It’s working over there. So I … Read more