Home > iis 7 > Convert Old .htaccess rules to IIS Rewrite Rules

Convert Old .htaccess rules to IIS Rewrite Rules

September 25Hits:2
Advertisement

I've started to host my own site on IIS and it was previously hosted on DreamHost on Apache so I have an .htaccess file with rewrite rules I would like to convert to the URL Rewrite module rules.

# initialize mod_rewrite RewriteEngine on RewriteBase /  # remove the www from the url # RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] # RewriteRule ^(.*)$ http://%1/$1 [R=301,L]  ###  BEGIN GENERATED REWRITE RULES  ####  RewriteCond %{REQUEST_FILENAME}/index.html -f RewriteRule ^(.*) $1/index.html  ####  END GENERATED REWRITE RULES  ####  # listing pages whose names are the same as their enclosing folder's RewriteCond %{REQUEST_FILENAME}/$1.html -f RewriteRule ^([^/]*)/$ %{REQUEST_FILENAME}/$1.html  # regular pages RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^.*$ %{REQUEST_FILENAME}.html  # set our custom 404 page ErrorDocument 404 /404.html 

I'm using the application Hyde to generate my static site, so would like to get this working if possible. I've tried importing the htaccess but the rules do not seem to give the right outcome.

Answers

If you want to just dump your .htaccess into your root folder and have IIS obey your rewrite rules, there's a plugin called ISAPI Rewrite. We use the paid version but the free version should do you just fine if it's just one website.

The IIS7 rewrite syntax is (obviously) totally different, and I don't know if any tools exist.

Related Articles

  • Transalate .htaccess allow deny rules to IIS rewrite rulesMarch 6

    I have no access to IIS manager so I need to edit the Web.config files. I had trouble translating this kinds of rules: <Limit GET> order deny,allow deny from all allow from .comodomain.com </Limit> Into IIS rewrite rules. Does anybody have som

  • Convert Old .htaccess rules to IIS Rewrite RulesSeptember 25

    I've started to host my own site on IIS and it was previously hosted on DreamHost on Apache so I have an .htaccess file with rewrite rules I would like to convert to the URL Rewrite module rules. # initialize mod_rewrite RewriteEngine on RewriteBase

  • IIS Rewrite Rule - how to manipulate {HTTP_HOST} stringFebruary 5

    I've just started using iis rewrite rules for the first time and I'm struggling with what I imagine is an easy rule. Basically, I wish to use this rule <rule name="redirect"> <match url="^(one$|two$|three$)" /> <action t

  • Creating IIS Rewrite RulesSeptember 26

    I'm having a hard time converting old .htaccess rewrite rules to new IIS ones so I was wondering if anyone could point me in the right direction. Below are some example URLs I would like rewriting. http://example.org.uk/about/ Rewrites to http://exam

  • Can I have IIS rewrite rules write to a file?July 12

    Extendng on my question at Is it possible to write a regular expression that catches a match that others have missed in IIS? I would like to know if I can have the rewrite rules write to a file. For example if the file test.aspx is not found and rath

  • IIS rewrite rule to check for querystring and add it if its not thereSeptember 29

    I'm trying to make a IIS URL rewrite rule that appends an URL parameter to the URL. The url parameter is hssc. So, any url that is processed through the server, needs that parameter. Keeping in mind that some urls will have their own params already,

  • Apache htaccess strange behaviour with rewrite rulesMarch 27

    I don't know what's going on but I cannot make use of the rewrite module. In my .htaccess file I have a rule like this: RewriteRule ^test$ test.php. If test.php does not exists I get a 404 error saying that it cannot find the test.php file, which is

  • Can't find IIS Rewrite Rule in Config XMLJanuary 14

    I created a new URL rewrite rule through the IIS manager GUI. But when I browse to the site config XML file, I don't see any rewrite rules even though I have confirmed the rewrite is working. I had expected that the rewrite GUI would generate the cor

  • Help with IIS rewrite ruleAugust 9

    I need to create a rewrite rule as follows: OldPage.aspx?UserId=12345 should redirect to NewPage.aspx?Id=12345 the '12345' can be any numeric value.) I have the page redirect working, but not sure how to change the 'UserId' to 'Id' (I can do it in my

  • IIS rewrite rules for subdomain and nonexistent filesMarch 28

    Setup: I know how to use a rewrite rule to route urls to a routing script such as router.php. I know how to use a rewrite rule to route urls containing a subdomain to subfolders in the document root. What I really need is to combine the two concepts.

  • IIS Rewrite rule based on length paramFebruary 12

    I have the following rewrite rule <rule name="Product short redirect" stopProcessing="true"> <match url="product/([A-Za-z0-9]+)/$" ignoreCase="true" /> <action type="Redirect" redirectType=&

  • IIS rewrite rules skipped even though the pattern matchesMay 14

    Sorry for the vague title, the problem is too complex to summarize in a short phrase... I'm trying to set up the following redirection rules: blog.mydomain.net/en/something: redirected to www.mydomain.com/something blog.mydomain.net/fr/something: red

  • IIS Rewrite rule to redirect and remove query stringDecember 13

    I'm trying to rewrite in IIS 7.5 from an old website to the new one. We have a list of URL's with and without query strings. I can get the URL's without query strings to redirect but not with. <rewrite> <rewriteMaps configSource="rewritemaps

  • Creating clean redirect rules with IIS Rewrite Module if UA is mobileFebruary 9

    I would like to use Rewrite Module over IIS to redirect certain URLs i have on desktop site to a mobile site. for example: If UA is mobile, and requested url is "mysite.com/page1", then redirect to "m.mysite.com/page1" If UA is mobile,

  • Hard to find a good rewriting ruleOctober 26

    I need to rewrite an adress for my WP site. I encounter difficulties, and I may need your kindfull help. In fact, in need to rewrite www.sitename.com/?post_type=portfolio&portfolio-category=a-category&portfolio-tag=a-tag into www.sitename.com/my-s

  • Drupal and Apache Rewrite Rules

    Drupal and Apache Rewrite RulesJuly 26

    Hi, I've set up a Drupal-based web site. Drupal is right in the web server's document root. Now Drupal can generate search-engine friendly URLs (www.domain.com/a/b/c instead of www.domain.com/index.php?1=a&2=b&3=c), but to use this feature I have

  • Custom rewrite rule for backend/admin?January 14

    I would like to create a custom rewrite rule that will take the URL: http://domain/submit-project/add but display http://domain/wp/wp-admin/post-new.php?post_type=project Is there any way to do this? I am trying to add the rewrite rule so in my theme

  • nginx wordpress rewrite rule conflicted with stub_status moduleDecember 23

    i'm got a problem when i was trying to enable stub_status module on my wordpress based site. the following is my configuration in nginx.conf. location /status { stub_status on; access_log off; } if (!-e $request_filename){ rewrite ^(.+)$ /index.php?q

  • Rewrite Rules syntax for nginx (in Web Domain - Redirect field) in ISPConfig 3?July 7

    Hello, I'm attempting to add a rewrite rule to this field, but the input validation filter that ISPConfig employs rejects the rule with "Invalid Rewrite Rules". The same rule works as expected when pasted directly into the nginx configuration fi

  • rewrite rules social share linksJune 19

    Within the Ultimatum's theme childtheme.php I've added rewrite rules to the rewrite rules and it works perfectly fine. However, it does not work if the URL is shared in Facebook or Twitter. The Facebook debugger returns "Could Not Follow Redirect Pat

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.706 s.