Directly have the root directory as shown below, as you can see I have a folder and file with the same name as store , you Can you please let me know how to write RewriteRule
in .htaccess
to redirect any request like
http://clients/shop/
orhttp://clients/shop
to
http://clients/shop.php
I already tried it
RewriteRule ^shop/(.+) shop.php [L,R]
But this adds the wrong address to the URL
======================
renew
====================
Okay, I found this solution works to some extent
DirectorySlash Off RewriteEngine on RewriteCond %{THE_REQUEST} \s/+shop [NC] RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*) /.php [R=302,L]
But, it only works when the request is like http://clients/shop
, and it shows the directory page when the request is like http://clients/shop/
P粉1292756582024-04-05 10:46:58
This should do the job for you
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\ /shop [NC] RewriteRule ^shop - [R=404,L] RewriteRule ^shop/(.*)$ shop.php [L,NC]