简体   繁体   中英

Mod_Rewrite rule ignored on Server

i got the following RewriteRule in my .htaccess -file:

RewriteRule ^([a-z]+)/(.*)$ distributor.php?file=$1&params=$2 [L]

If i request for example " www.domain.local/index/id/123 " on my local system via Xampp this works perfectly. It requests distributor.php (which does a simple var_dump($_GET); ) and results in the expected output:

array
  'file' => string 'index' (length=5)
  'params' => string 'id/123' (length=6)

When uploading these files to the server, the rule does not apply. The browser simply outputs the DirectoryIndex file.

I am confused after hours of trying to fix it and would be thankful for any kind of help

Thanks

Update:

if i replace the slash by a dash and use the following rule:

RewriteRule ^([a-z]+)-(.*)$ distributor.php?file=$1&params=$2 [L]

the whole thing works both on my local system and on the server.

Is there anything i need to change to use the slash on the server as well?

Locate your apache configuration file and then add these lines :

<Directory /path/to/your/web/application>
    Options Indexes FollowSymlinks MultiViews
    AllowOverride all
    Order allow,deny
    allow from all
</Directory>

and then if the following line does not exist, write it :

AccessFileName .htaccess

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