Travis Pessetto
Travis Pessetto

Reputation: 3298

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

Upvotes: 1

Views: 953

Answers (1)

Felipe Alameda A
Felipe Alameda A

Reputation: 11809

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.

Upvotes: 3

Related Questions