Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: Hosting Isapi_Rewrite Vesion 3 examples (Isapi Rewrite)

  1. #1
    Join Date
    May 2009
    Location
    Tulsa, OK
    Posts
    220

    Default Hosting Isapi_Rewrite Vesion 3 examples (Isapi Rewrite)

    Hostek.com has lots of experience with Isapi_Rewrite Hosting. Here are a couple of examples of using Isapi_Rewrite Version 3:

    NOTE: Place the rewrite rules in a file named .htaccess and place it at the web root (ie, /wwwroot folder)

    Redirecting non-www version to www
    Code:
    RewriteEngine on
    
    RewriteCond %{HTTPS} (on)?
    RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
    RewriteCond %{REQUEST_URI} (.+)
    RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]

    Suppose you have URL like www.example.com/foo.asp?a=A&b=B&c=C and you want to access it as www.example.com/foo.asp/a/A/b/B/c/

    Code:
    RewriteEngine on
    RewriteRule ^(.*?\.asp)/([^/]*)/([^/]*)(/.+)? $1$4?$2=$3 [NC,LP,QSA
    Additional Isapi_Rewrite rules/examples can be found at the Isapi_Rewrite site.

  2. #2
    Join Date
    Jul 2009
    Posts
    182

    Post How to point HTTP to HTTPS (Isapi Rewrite 3)

    Suppose you have URL like http://shop.example.com and you want your visitors to be redirected to https://shop.example.com

    Here is example how to force SSL for certain folder. Simply put following rules into the .htaccess file in this folder:

    Code:
    RewriteEngine on
    
    #Fix missing trailing slash char on folders
    RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]
    
    #Redirect non-HTTPS to HTTPS
    RewriteCond %{HTTP:Host} (.*)
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} (.*)
    RewriteRule .? https://%1%2 [R,L]

  3. #3
    nitewatch Guest

    Default Trentino judiciary

    I have added the following to the .htaccess:

    RewriteEngine on
    RewriteRule ^(/(ajaxproxy|flex2gateway|jrunscripts|cfide|cfformga teway|railo-context|files|images|javascripts|miscellaneous|sty lesheets).*)$ $1 [L,I]
    RewriteRule ^(/.+/.+/.*\?.+\..*)$ /rewrite.cfm/$1
    RewriteRule ^(/[^.]*)$ /rewrite.cfm/$1

    It doesn't appear to be working. Can you confirm this is correct syntax?

    Thanks!

  4. #4
    Join Date
    Jun 2009
    Posts
    35

    Default re: Trentino judiciary

    nitewatch,

    Try removing the beginning forward slash('/') in each rewrite rule. Also, I would recommend revising the first rewrite rule as it does not look correct for excluding those folders from the rewriting. Below is an example of what I would suggest:

    Code:
    RewriteEngine on
    RewriteRule ^(ajaxproxy|flex2gateway|jrunscripts|cfide|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets) - [L,I]
    RewriteRule ^(.+/.+/.*\?.+\..*)$ /rewrite.cfm/$1
    RewriteRule ^([^.]*)$ /rewrite.cfm/$1

    If that does not resolve the issue, try using the test files from the following post to determine if ISAPI_Rewrite V3 is working on your site:
    http://forum.hostek.com/showthread.php?t=147


    If the test does not work, then submit a support ticket as the post mentions, and we can check into it.(note: Be sure to include your domain name in the ticket)


    If the test confirms that ISAPI_Rewrite V3 is working, then we would need to know an example of a URL that you are wanting rewritten to determine if rules 2 and 3 would actually rewrite it.

  5. #5
    Join Date
    May 2009
    Location
    Tulsa, OK
    Posts
    220

    Default

    Example on how to prevent certain spiders from crawling your site:

    Code:
    RewriteEngine on
    
    RewriteCond %{HTTP_USER_AGENT} ^Baiduspider.*$
    RewriteRule .* /block.htm
    
    RewriteCond %{HTTP_USER_AGENT} ^Yandex.*$
    RewriteRule .* /block.htm

  6. #6
    Join Date
    May 2009
    Location
    Tulsa, OK
    Posts
    220

    Default

    To have your index.htm page auto redirect to index.asp user this example:


    Code:
    RewriteEngine on
    
    RewriteRule index.htm index.asp [I,O,R=301,L]

  7. #7
    Join Date
    May 2009
    Location
    Tulsa, OK
    Posts
    220

    Default

    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.

    Let's say you want to have a URL display like:
    Code:
    http://your_domain.com/some-folder/34-77-some-key-word.html
    But you want that to really process a query like:
    Code:
    http://your_domain.com/folder/search.asp?country=34&city=77

    Code:
    RewriteEngine on
    RewriteRule ^some-folder/([^-]+)-([^-]+)-.*$ /folder/search.asp?country=$1&city=$2

  8. #8
    Join Date
    May 2009
    Location
    Tulsa, OK
    Posts
    220

    Default

    A common use for this one is when using Mura, but you don't want the index.cfm in URL

    Example: domain.com/test/test2

    Would really load what would be at: domain.com/index.cfm/test/test2

    Code:
    RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) /index.cfm/$1 [L]

  9. #9
    Join Date
    Jun 2009
    Posts
    35

    Default

    Rewrite all wild-card sub-domain requests to a folder without affecting "your_domain.com" or "www.your_domain.com":

    Wild-Card Subdomains

    Code:
    # Ignore requests that are already rewritten 
    RewriteRule ^subdomainfolder/.*$ - [NC,L]
    
    # Rewrite all requests to non-www sub-domains to /subdomainfolder 
    RewriteCond %{HTTP_HOST} !^(www\.)?your_domain\.com$ [NC] 
    RewriteRule ^(.*)$ /subdomainfolder/$1 [L]

  10. #10
    acemonroe Guest

    Default Question

    How do I redirect a complete directory such as /joomlainstallation in the root as the primary page?

    I have a site that is currently outdated such as example.com and have created a joomla installation inside that directory that is viewable at example.com/joomlainstallation. My goal is to direct the /joomlainstallation to example.com?

    Any help?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •