skip to Main Content

I am currently in the process of moving from parallels plesk for centos to parallels plesk for windows. The only snag i’ve hit is I realized .htaccess won’t work anymore.
Here was my .htaccess:

options -indexes +FollowSymLinks
RewriteEngine on 


RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php

RewriteRule ^(verify)/(.*)/([a-zA-Z0-9_-]+)$ validate_account.php?usr=$3&hash=$4 [QSA,L]
RewriteRule ^(post)/([a-zA-Z0-9_-]+)$ news.php?post=$2 [NC,QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^uploads/avatars/(.+)$ ../uploads/avatars/$1 [L,NC]

Redirect 301 /signup /register

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

errordocument 404 /404.php
errordocument 403 /404.php
errordocument 500 /404.php

allow from all
#deny from all
#allow from 98.115.168.25
deny from 162.144.91.203 #attempted brute force
deny from 74.208.100.64 #attempted brute force
deny from 185.57.82.25 #tried to ddos

Here is the web.config I generated with a website:

<rule name="rule 1F">
    <match url="^(.*)$"  />
    <action type="Rewrite" url="/{R:1}.php"  />
</rule>
<rule name="rule 2F" stopProcessing="true">
    <match url="^(verify)/(.*)/([a-zA-Z0-9_-]+)$"  />
    <action type="Rewrite" url="/validate_account.php?usr={R:3}&amp;hash={R:4}"  appendQueryString="true" />
</rule>
<rule name="rule 3F" stopProcessing="true">
    <match url="^(post)/([a-zA-Z0-9_-]+)$"  ignoreCase="true" />
    <action type="Rewrite" url="/news.php?post={R:2}"  appendQueryString="true" />
</rule>
<rule name="rule 4F" stopProcessing="true">
    <match url="^uploads/avatars/(.+)$"  ignoreCase="true" />
    <action type="Rewrite" url="/../uploads/avatars/{R:1}"  />
</rule>
<rule name="rule 5F">
    <match url="(.*)"  />
    <action type="Rewrite" url="/https://%{HTTP_HOST}%{REQUEST_URI}"  />
</rule>
<rule name="rule 6F" stopProcessing="true">
    <match url="^"  />
    <action type="Rewrite" url="/http://%1%{REQUEST_URI}"  />
</rule>

It gives me 500 internal server error whenever I try accessing the site, any help would be appreciated.

2

Answers


  1. Chosen as BEST ANSWER

    After installing the free version of ISAPI Rewrite I was able to use .htaccess with IIS 7.


  2. Try this and let me know

    <rule name="rule 1X">
            <match url="^(.*)$"  />
            <action type="Rewrite" url="/{R:1}.php"  />
        </rule>
        <rule name="rule 2X" stopProcessing="true">
            <match url="^(verify)/(.*)/([a-zA-Z0-9_-]+)$"  />
            <action type="Rewrite" url="/validate_account.php?usr={R:3}&amp;hash={R:4}"  appendQueryString="true" />
        </rule>
        <rule name="rule 3X" stopProcessing="true">
            <match url="^(post)/([a-zA-Z0-9_-]+)$"  ignoreCase="true" />
            <action type="Rewrite" url="/news.php?post={R:2}"  appendQueryString="true" />
        </rule>
        <rule name="rule 4X" stopProcessing="true">
            <match url="^uploads/avatars/(.+)$"  ignoreCase="true" />
            <action type="Rewrite" url="/../uploads/avatars/{R:1}"  />
        </rule>
        <rule name="rule 5X">
            <match url="(.*)"  />
            <action type="Rewrite" url="/https://%{HTTP_HOST}%{REQUEST_URI}"  />
        </rule>
        <rule name="rule 6X" stopProcessing="true">
            <match url="^"  />
            <action type="Rewrite" url="/http://%1%{REQUEST_URI}"  />
        </rule>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search