Home > Software design >  The link address in htaccess redirect in php repeats the address indefinitely
The link address in htaccess redirect in php repeats the address indefinitely

Time:03-01

After puting this code in .htaccess it infinitly repeat the url in brower for example

https://www.example.com/mv/project/mv/project/mv/project/mv/project/mv/project...

.htaccess

Options  FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php

RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [l,R=404]

CodePudding user response:

What are you trying to achieve with these lines of code RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$", perhaps I can give some help. This part below makes you get rid of the .php file extension name.

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
  • Related