I want to remove all .php extensions from URL with htaccess but also redirect for example the example.com/profile.php?user=test
to example.com/profile/test
the following code will remove all .php extensions, but getting 500 error because of the single file (profile.php) redirection
<IfModule mod_rewrite.c>
Options FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]
RewriteRule ^(.*)$ profile.php?user=$1 [QSA,L]
</IfModule>
apache2 log:
Request exceeded the limit of 10 internal redirects due to probable configuration error.
CodePudding user response:
please add this code, it redirects the user paramater to url.
<IfModule mod_rewrite.c>
Options FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^profile/([^/] )?$ profile.php?user=$1 [L,QSA]
</IfModule>