简体   繁体   中英

PHP URL rewrite redirecting to wrong file

I have the following files in my root folder:

listing_location.html
listing_location.php

I am using the following link from other page to access to redirect to listing_location.php < a href="listing_location/< ? php echo "$_SESSION["listing_id"]; ?>" > location < / a >

below is the rewrite rule

RewriteRule ^listing_location/([0-9]+)/?$ listing_location.php?listing_id=$1

But when I click the link it redirects me to listing_location.html/{some-number} and gives 404 error.

Disabling content negotiation will probably solve your problem.Try this.

Options -MultiViews    
RewriteEngine On 
RewriteRule ^pricing/([0-9]+)/?$ pricing.php?listing_id=$1 
RewriteRule ^listing_location/([0-9]+)/?$ listing_location.php?listing_id=$1

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