Madbuddy
Madbuddy

Reputation: 11

.htaccess RewriteRule on apache not working

I've tried everything. The following .htaccess file seems to work wonders on my local XAMPP server:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule pilot/([^/]*)$ /pilot.php?name=$1
</IfModule>

But it sadly doesn't work when i upload it to my web-host. Any help or input would be appreciated.

EDIT: I forgot to add that it does redirect to the file correctly, but the variable isn't grabbed for some odd reason. I've also tried this:

RewriteRule ^pilot/(.*)$ /pilot.php?name=$1

But it doesn't work either. I'm completely lost. My web-host is OVH.

EDIT2: I was at least able to narrow down the issue a little bit. I've found that doing this: (note the - instead of the /)

RewriteRule ^pilot-(.*)$ pilot.php?name=$1

Works absolutely fine. There is something wrong with the slash, but i can't figure a way to fix it.

EDIT3: Well, apparently

RewriteRule ^character/([a-zA-Z_]+)$ show.php?name=$1 [L]

works but

RewriteRule ^pilot/([a-zA-Z_]+)$ show.php?name=$1 [L]

doesn't. Oh well..

Upvotes: 1

Views: 57

Answers (1)

Croises
Croises

Reputation: 18671

Try to add this in your htaccess:

Options -MultiViews

The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements. http://httpd.apache.org/docs/2.2/en/content-negotiation.html

And after that work well with:

RewriteRule pilot/([^/]*)$ /pilot.php?name=$1

Upvotes: 1

Related Questions