内部服务器错误 - > .htaccess中的RewriteRule

时间:2015-05-09 19:53:33

标签: apache .htaccess mod-rewrite

我的.htaccess文件出现内部服务器错误:

Allow from all

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
    RewriteEngine On

    # Important: RewriteBase
    # If you installed the web app in a sub-directory you have to set this accordingly.
    # Note: No trailing slash! (f.e. /BoNeMEAL or /mc-server/ban-management)
    RewriteBase /home/webpages/lima-city/townville/bans

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

希望有人可以帮助我。

1 个答案:

答案 0 :(得分:1)

RewriteBase必须包含从服务器根目录(由www.example.com指向的dir)到.htaccess放置的目录(在本例中)。所以如果您的服务器根目录在/ home / webpages / lima-city / townville / bans然后说

if len(sys.argv) == 4:
   ### do something
    pass
else:
    print
    "usage: #### something here"
    exit(-1)