So I want to make a project, well I need .htacsses, when I tried it, it didn’t work. So I tried to make a simple .htacsses, this is the content
RewriteEngine On
RewriteRule ^test.html$ test.php [L]
And in test.php I just filled with simple code hello world, when I tried to open /test.html, I got error 404. What should I do?
That’s not a mistake from a technical aspect, if you don’t want RewriteCond, you can do it. There’s nothing wrong with it, Apache will just apply the rule everywhere.
mod_rewrite is enabled by default on our hosting, so that’s not the problem. The code also seems fine at first sight.
A few possible reasons:
Please check that the .htaccess file is loaded correctly. Please double check that it’s actually called .htaccess, and that it’s located in the right directory on your account.
Please try checking the page in Incognito Mode in your browser. If you opened the page with bad .htaccess rules before, your browser may have cached the 404 redirect and may keep sending you there despite the code having changed.