简体   繁体   中英

htaccess mod_rewrite is not working on 1&1

I have a .htaccess file located in my webservers /marssolover/protected folder which allows me to get a file from the protected folder and stream it via the filestreamer.php file located in the same folder. mod_rewrite works fine on localhost but not at 1&1.

I have googled and tried some of the suggestions ending up with this .htaccess file:

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>

But, it is still not working. I've read that it might have something to do with MultiViews, but I thought that was disabled by Options -MultiViews

You may try this instead:

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]

Maps silently

http://example.com/MARS/MARSSecure/anything

To:

http://example.com/MARS/MARSSecure/filestreamer.php?file=anything

Try using flags [R,L,NC] during testing so you can see the substitution URL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM