Hello, how do you remove the .php extension from the url of your site? I already tried to do it but either it doesn’t work or the site doesn’t work anymore.
You can put the following code into your .htaccess file:
RewriteEngine On
Options +MultiViews
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
8 Likes
It’s not working, this is my htaccess file with your lines:
php_value display_errors On
php_value mbstring.http_input auto
php_value date.timezone Europe/Paris
ErrorDocument 400 ######################
ErrorDocument 401 ######################
ErrorDocument 403 ######################
ErrorDocument 404 ######################
ErrorDocument 503 ######################
DirectoryIndex index.php index.html index.htm index2.html
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:CF-Visitor} !{"scheme":"https"}
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Redirect 301 /login https://newlist.free.nf/
Redirect 301 /account https://newlist.free.nf/signUp.php
Options +MultiViews
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Try to rename your current .htaccess file to old.htaccess and create a new .htaccess file with just the code that YT_Xaos gave. See if that works.
1 Like
I don’t know what you mean, it’s working fine:
8 Likes
I assume what they mean is that requesting the page with the .php
extension does not redirect to the version without it, so https://newlist.free.nf/signUp.php does not redirect to https://newlist.free.nf/signUp.
6 Likes
Actually it works well it’s just the link that didn’t redirect to the right url, thank you
2 Likes
This should help:
4 Likes
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.