[英]htaccess mod_rewrite is not working on 1&1
我有一個.htaccess文件位於我的webservers / marssolover / protected文件夾中,它允許我從受保護的文件夾中獲取文件,並通過位於同一文件夾中的filestreamer.php文件流式傳輸。 mod_rewrite在localhost上工作正常但在1和1時不能正常工作。
我用Google搜索並嘗試了一些以.htaccess文件結尾的建議:
AddHandler x-mapp-php6 .php
RewriteEngine On
Options -MultiViews
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteBase /MARS/MARSSecure
RewriteRule ^(.*)$ filestreamer.php?file=$1 [L]
<Files .htaccess>
order allow,deny
deny from all
</Files>
但是,它仍然無法正常工作。 我已經讀過它可能與MultiViews有關,但我認為它被Options -MultiViews
禁用了
您可以嘗試這樣做:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_URI} !filestreamer\.php [NC]
RewriteCond %{REQUEST_URI} ^/MARS/MARSSecure/(.*)/? [NC]
RewriteRule .* /MARS/MARSSecure/filestreamer.php?file=%1 [L,NC]
靜靜地映射
http://example.com/MARS/MARSSecure/anything
至:
http://example.com/MARS/MARSSecure/filestreamer.php?file=anything
在測試期間嘗試使用標志[R,L,NC],這樣您就可以看到替換URL。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.