Results 1 to 7 of 7

Thread: Rewrite URL and IIS6

  1. #1
    New user
    Join Date
    02-17-10.
    Posts
    12

    Default Rewrite URL and IIS6

    I am running 2.7.6 and wish to "remove" the index.php prefix which is inserted into the path for all of my web pages as it breaks the site when running IE6 (I know it's ancient but there are still some users!). All other browser versions are fine.

    I have checked "Rewrite URLs" and renamed ._htaccess to .htaccess but this has made no difference. Is this just a fact of life under Windows/IIS or is there something else I can do to remove this?

    Thanks

    Mike

  2. #2
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: Rewrite URL and IIS6

    Hi magictrick,

    Quote Originally Posted by magictrick
    ...as it breaks the site when running IE6
    The "index.php" URL fragment breaks the website in IE6 browsers? Strange! Never heard about such an "issue"...

    Quote Originally Posted by magictrick
    I have checked "Rewrite URLs" and renamed ._htaccess to .htaccess but this has made no difference.
    Have you set the right "RewriteBase" in your server configuration file ".htaccess"?
    Contao Community Moderator
    → Support options

  3. #3
    New user
    Join Date
    02-17-10.
    Posts
    12

    Default Re: Rewrite URL and IIS6

    This is the currrent contents of .htaccess

    ##
    # Rewrite base
    ##
    RewriteEngine On
    RewriteBase /

    ##
    # Block malicious requests
    ##
    RewriteCond %{REQUEST_URI} (ftp|https?):|/etc/ [NC,OR]
    RewriteCond %{QUERY_STRING} (ftp|https?):|/etc/ [NC]
    RewriteRule .* - [F,L]

    ##
    # Compress .js and .css files
    ##
    AddEncoding gzip .gz
    <FilesMatch "\.js\.gz$">
    AddType "text/javascript" .gz
    </FilesMatch>
    <FilesMatch "\.css\.gz$">
    AddType "text/css" .gz
    </FilesMatch>
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME} \.(js|css)$
    RewriteCond %{REQUEST_FILENAME}.gz -f
    RewriteRule ^(.*)$ $1.gz [QSA,L]

    ##
    # Rewrite TYPOlight URLs
    ##
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .*\.html$ index.php [L]


    What do I need to check?

    Thanks for reply

    Mike

  4. #4
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: Rewrite URL and IIS6

    If your domain is mapped to Contao's installation directory (i.e. the root/main directory of the installation) then
    Code:
    RewriteBase /
    is correct. Otherwise you have to set here the right directory as RewriteBase.
    Contao Community Moderator
    → Support options

  5. #5
    New user
    Join Date
    02-17-10.
    Posts
    12

    Default Re: Rewrite URL and IIS6

    I installed TL into a virtual directory /TEX2011, so I have amended .htaccess ReWriteBase to /TEX2011 but the index.php part still appears in the name and IE6 still doesn't show the complete page.

    I can see that the html is correct and complete if I view source it's just not rendered to the screen, I'm pretty convinced it's the index.php/ part that's causing it because the homepage for the site displays correctly.

    Mike

  6. #6
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: Rewrite URL and IIS6

    Hi, since I have no experience with Windows web servers, I do not know exactly how the URL rewriting mechanism work there. You have to check the server configuration if there is available and enabled the corresponding URL Rewrite Module (equivalent to Apache's "mod_rewrite" module). Maybe a filter called "ISAPI_Rewrite" (or similar)...

    Unfortunatly, I can not say more (due for lack of experience with IIS)
    Contao Community Moderator
    → Support options

  7. #7
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Rewrite URL and IIS6

    I happen to have solved this problem with TYPOlight on an IIS server. First off; IIS does no rewriting of its own. Or at least not that I know of, so just changing the .htaccess and the rewrite switch will not help you much!

    You need to install an isapi module for that. I used Ionic's Isapi Rewrite Filter. When you have that filter installed (follow their instructions) then you need to construct a version of the .htaccess file that the rewriter will understand (it will not use the existing .htaccess files)

    The file I made is called IsapiRewrite4.ini:
    Code:
    # IsapiRewrite4.ini
    #
    # TYPOlight Rewrite URL
    #
     
    #RewriteLogLevel 5
    RewriteRule ^(/?index\.php.*)$ $1 [L]
    RewriteRule ^(/?preview\.php.*)$ $1 [L]
    RewriteRule ^(/?)(.*\.html)$ $1index.php/$2 [L]
    
    #RewriteRule (.*css)$ $1 [I,L]
    #RewriteRule (.*xml)$ $1 [I,L]
    #RewriteRule (.*js)$ $1 [I,L]
    #RewriteRule ^/(?!index.php)(?!tl_files)(?!system)(?!plugins)(?!templates)(?!typolight)(?!contao)(.*)$ /index.php/$1 [I,L]
    There are no guarantees that my file will work, but at least it gives you an almost complete method as to how to get this working!

    ps, also I am not sure what IIS server I did this on. That means that this method might only work for some IIS versions. Additionally; it was for an earlier TYPOlight version so the htaccess for contao may have changed. I did include contao into the rules I posted above.

Bookmarks

Posting Permissions

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