<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.hostek.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Calebd</id>
		<title>Hostek.com Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.hostek.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Calebd"/>
		<link rel="alternate" type="text/html" href="https://wiki.hostek.com/Special:Contributions/Calebd"/>
		<updated>2026-05-25T06:11:40Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.2</generator>

	<entry>
		<id>https://wiki.hostek.com/index.php?title=ISAPI_Rewrite&amp;diff=2950</id>
		<title>ISAPI Rewrite</title>
		<link rel="alternate" type="text/html" href="https://wiki.hostek.com/index.php?title=ISAPI_Rewrite&amp;diff=2950"/>
				<updated>2017-01-02T07:11:54Z</updated>
		
		<summary type="html">&lt;p&gt;Calebd: /* Simple Redirects and Rewrites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__FORCETOC__&lt;br /&gt;
&lt;br /&gt;
= ISAPI_Rewrites and Redirects Version 3 =&lt;br /&gt;
&lt;br /&gt;
ISAPI_Rewrite Version 3 is a powerful URL manipulation engine based on regular expressions. Hostek.com has lots of experience with Isapi_Rewrite Hosting. Here are a couple of examples of using Isapi_Rewrite Version 3:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt; Place the rewrite rules in a file named .htaccess and place it at the web root (ie, /wwwroot folder)&amp;lt;br /&amp;gt;If you do not have a .htaccess file created already then use a text editor like Notpad and save the file as a .htaccess or use the File Manager in the hosting control panel to create the .htaccess file on the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Simple Redirects and Rewrites ==&lt;br /&gt;
&lt;br /&gt;
==== Redirecting to a different domain ====&lt;br /&gt;
If you need to redirect your website to another website&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [QSA,R=301]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Rewrite a Folder to another Folder ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
RewriteBase /&lt;br /&gt;
&lt;br /&gt;
RewriteRule ^oldfolder$ /correctfolder [NC,R=301,L] &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Redirect File Names ====&lt;br /&gt;
To have your index.htm page auto redirect to index.asp user this example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
&lt;br /&gt;
RewriteRule index.htm index.asp [R=301,L]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Subfolder Rewrite ====&lt;br /&gt;
To redirect your domain to a subfolder of that domain example: www.domain.com to www.domain.com/folder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
&lt;br /&gt;
# Exclude requests already going to /subfolder to avoid an infinite loop&lt;br /&gt;
RewriteRule ^subfolder.*$ - [NC,L]&lt;br /&gt;
&lt;br /&gt;
# Rewrite normal requests to /subfolder&lt;br /&gt;
RewriteRule ^(.*)$ /subfolder/$1 [L]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== non-www. to www. Redirects ====&lt;br /&gt;
&lt;br /&gt;
Redirecting non-www version to www., example domain.com to www.domain.com&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^$&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteCond %{HTTPS}s ^on(s)|&lt;br /&gt;
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== www. to non-www. Redirects ====&lt;br /&gt;
&lt;br /&gt;
Redirecting www version to non-www., example www.domain.com to domain.com&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^www.domain.com&lt;br /&gt;
RewriteRule ^ http://domain.com%{REQUEST_URI} [R=301,L]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== URL Rewrite ====&lt;br /&gt;
&lt;br /&gt;
Suppose you have URL like www.example.com/foo.asp?a=A&amp;amp;b=B&amp;amp;c=C and you want to access it as www.example.com/foo.asp/a/A/b/B/c/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
RewriteRule ^(.*?\.asp)/([^/]*)/([^/]*)(/.+)? $1$4?$2=$3 [NC,LP,QSA]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== WordPress Permalinks ====&lt;br /&gt;
&lt;br /&gt;
WordPress Permalinks using mod_rewrite are for Linux, but ISAPI_Rewrite does offer the equivalent. If you want to have index.php not show in the url try using these in your .htaccess file.&lt;br /&gt;
&lt;br /&gt;
If your WordPress site is in the wwwroot folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
# BEGIN WordPress&lt;br /&gt;
&lt;br /&gt;
#Options +Followsymlinks&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
RewriteBase /&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule . /index.php [NC,L]&lt;br /&gt;
&lt;br /&gt;
# END WordPress&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your WordPress site is in a subfolder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
# BEGIN WordPress&lt;br /&gt;
&lt;br /&gt;
#Options +Followsymlinks&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
RewriteBase /&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule . /subfolder/index.php [NC,L]&lt;br /&gt;
&lt;br /&gt;
# END WordPress&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Redirect wwwroot/public_html to subfolder ====&lt;br /&gt;
&lt;br /&gt;
Allows you load your domain from a subfolder instead of the wwwroot/public_html folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www.)?example.com$&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/subfolder/ &lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f &lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d &lt;br /&gt;
RewriteRule ^(.*)$ /subfolder/$1 &lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www.)?example.com$&lt;br /&gt;
RewriteRule ^(/)?$ subfolder/index.html [L]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== HTTP to HTTPS SSL Rewrites ==&lt;br /&gt;
&lt;br /&gt;
==== SSL ====&lt;br /&gt;
Suppose you have URL like http://shop.example.com and you want your visitors to be redirected to https://shop.example.com&lt;br /&gt;
&lt;br /&gt;
Here is example how to force SSL for certain folder. Simply put following rules into the .htaccess file in this folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
&lt;br /&gt;
#Fix missing trailing slash char on folders&lt;br /&gt;
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]&lt;br /&gt;
&lt;br /&gt;
#Redirect non-HTTPS to HTTPS&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
&lt;br /&gt;
RewriteCond %{SERVER_PORT} !443&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)$&lt;br /&gt;
RewriteRule ^(.*)$ https://%2/$1 [R,L]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Non-www, non-HTTPS to www, HTTPS redirects====&lt;br /&gt;
 RewriteEngine on&lt;br /&gt;
 RewriteCond %{SERVER_PORT} !443&lt;br /&gt;
 RewriteCond %{HTTP_HOST} !^$&lt;br /&gt;
 RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
 RewriteCond %{HTTPS} ^on(s)|&lt;br /&gt;
 RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R,L]&lt;br /&gt;
&lt;br /&gt;
==== Shared SSL ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
&lt;br /&gt;
# handle non-www HTTPS redirects. Consecutive conditions are implicitly ANDed together.&lt;br /&gt;
RewriteCond %{SERVER_PORT} ^443$&lt;br /&gt;
RewriteCond  %{HTTP_HOST}  ^(?!www\.).*mywebsite\.com$&lt;br /&gt;
RedirectRule ^/(.*)$ https://secure#.ezhostingserver.com/mywebsite-com/$1 [R=301]&lt;br /&gt;
&lt;br /&gt;
# All requests arriving to this point either use www for the hostname, or use &lt;br /&gt;
# HTTP for the protocol. &lt;br /&gt;
&lt;br /&gt;
# handle non-www non-HTTPS redirects&lt;br /&gt;
RewriteCond  %{HTTP_HOST}  ^(?!www\.).*mywebsite\.com$&lt;br /&gt;
RedirectRule ^/(.*)$ http://www.mywebsite.com/$1 [R=301]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Site Crawlers ==&lt;br /&gt;
&lt;br /&gt;
Example on how to prevent certain spiders from crawling your site.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
&lt;br /&gt;
RewriteCond %{HTTP_USER_AGENT} ^Baiduspider.*$&lt;br /&gt;
RewriteRule .* /block.htm&lt;br /&gt;
&lt;br /&gt;
RewriteCond %{HTTP_USER_AGENT} ^Yandex.*$&lt;br /&gt;
RewriteRule .* /block.htm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Wild-Card Subdomains &amp;amp; Variables Rewrites ==&lt;br /&gt;
&lt;br /&gt;
Here is an example to show how to get the variables from positions 1 and 2 without it mattering how many items are in the URL. In other words, a good example for a rewrite rule for optional parameters.&lt;br /&gt;
&lt;br /&gt;
==== Variable URLs ====&lt;br /&gt;
Let's say you want to have a URL display like: http://your_domain.com/some-folder/34-77-some-key-word.html&lt;br /&gt;
But you want that to really process a query like:http://your_domain.com/folder/search.asp?country=34&amp;amp;city=77&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
RewriteRule ^some-folder/([^-]+)-([^-]+)-.*$ /folder/search.asp?country=$1&amp;amp;city=$2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Wild-Card Subdomains ====&lt;br /&gt;
&lt;br /&gt;
Rewrite all wild-card sub-domain requests to a folder without affecting &amp;quot;your_domain.com&amp;quot; or &amp;quot;www.your_domain.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre-wrap;&lt;br /&gt;
white-space: -moz-pre-wrap;&lt;br /&gt;
white-space: -pre-wrap;&lt;br /&gt;
white-space: -o-pre-wrap;&lt;br /&gt;
word-wrap: break-word&amp;quot;&amp;gt;&lt;br /&gt;
# Ignore requests that are already rewritten &lt;br /&gt;
RewriteRule ^subdomainfolder/.*$ - [NC,L]&lt;br /&gt;
&lt;br /&gt;
# Rewrite all requests to non-www sub-domains to /subdomainfolder &lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.)?your_domain\.com$ [NC] &lt;br /&gt;
RewriteRule ^(.*)$ /subdomainfolder/$1 [L]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more Examples and other uses please visit [http://www.helicontech.com/isapi_rewrite/doc/examples.htm#SEF Helicon Tech]&lt;br /&gt;
&lt;br /&gt;
[[Category:Windows]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:ISAPI_Rewrite]]&lt;/div&gt;</summary>
		<author><name>Calebd</name></author>	</entry>

	</feed>