I can't make a seo url

my code is:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f 

ErrorDocument 404 /404

but it isn’t working. when i enter “mysite.com/file.php”, it shows me page but when i enter “mysite.com/file” it saying me “404 Not Found” error. please help me.

Maybe try to add after all RewriteCond lines of what you posted this:

RewriteRule ^(.*)$ $1.php [L]
3 Likes

it doesn’t work

Then what is your website URL, so that we can help you better? Also, did you try to remove that [L] after the code I posted? You should insert my code after these two lines:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f

yes i removed [L] but it doesn’t working although. also my website is http://croxyweb.cf
this is the last changes of my code:

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

ErrorDocument 404 /404

does anyone know the solution to the problem?

I might be late to the party, but can you please use this code instead?

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L] 

ErrorDocument 404 /404
1 Like

Not working :frowning:

i think the reason for this is not the wrong path of .htaccess file not. because i copied the infinityfree’s original .htaccess file codes and pasted to the my .htaccess file. 404 page is work but seo url is not working

ok i think i can’t get any help about that.

Yes because the code is correct, but you’re not using it correctly.

You don’t need to copy/paste from original htaccess file.
So remove the content of your htaccess file, paste the code above in it then save.

1 Like

ss

.htaccess file in htdocs folder. what’s the wrong?

Can you remove the last line temporarily? It looks that cases the issue.

1 Like

when i does so it redirects me to infinityfree’s 404 page

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.