Jump to content

Cannot rewrite "path/" if path.php exists.


adrianTNT

Recommended Posts

Hello, I have a strange problem with mod rewrite, this rewrite rule shows 404 error:

 

RewriteRule ^admin(/)?$ admin.php

 

as long as the .php file is named the same. But if I rename existent file on server to something like admins.php and rewrite "admin/" to admins.php then it works ok.

It looks like I would not be able to rewrite "path/" if path.php exists

 

I am using a "grid" hosting account from Godaddy. These rules worked fine on some dedicated servers from where I got the site files.

Link to comment
https://forums.phpfreaks.com/topic/203240-cannot-rewrite-path-if-pathphp-exists/
Share on other sites

I think this is a problem with Apache Content Negotiation, but to be honest I've never ran into it myself so not sure how to fix it, perhaps disabling  mod_negotiation. Try checking the documentation at http://httpd.apache.org/docs/2.0/content-negotiation.html.

I also seen this... I have files as:

/image_files/120.jpg

and if I access same path without it's extension it still shows the file.

That happens with no rewrite rules from my end, I deleted the .htaccess to test this.

 

Let me know if this indicates any other issue, otherwise I am waiting for GoDaddy's answer and inform them about this other thing if needed. Looks like it is from their configuration, it is not a dedicated server so my access to settings is limited.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.