Website URL
Mod_rewrite seems not enabled
Error Message
Hi guys,
I was trying to use mod_rewrite and I created a simple .htaccess and saved it into my htdocs folder.
The file contains just RewriteEngine on but I get the error page:
Something Went Wrong!
Our apologies, but the website has encountered an error and cannot display this page at the moment.
The issue is likely due to a code error within the .htaccess file, which controls important server configurations. This error is not related to any PHP files or other website code.
If I comment that line, everything works.
Also, I tried this PHP and it tells me NOT AVAILABLE:
<?php
if (function_exists('apache_get_modules')) {
echo in_array('mod_rewrite', apache_get_modules())
? 'mod_rewrite ACTIVE'
: 'mod_rewrite INACTIVE';
} else {
echo 'apache_get_modules() NOT AVAILABLE';
}
?>
Older discussions in the forum say mod_rewrite is enabled .. .but it does it seem the case now.
Can you please help?
Thanks
mod_rewrite is enabled. A lot of PHP functions have been disabled due to security concerns and your script specifically use NOT AVAILABLE to indicate the function rather than the module is missing.
Make sure that you didn’t misspell the line.
If I put only this, without any rules:
RewriteEngine On
I get no errors.
If I try to add some other lines, like for example:
RewriteBase /
or
RewriteCond %{REQUEST_FILENAME} !-f
or
RewriteRule ^language/([a-z]{2})/?$ index.php?lang=$1 [L,QSA]
I get the same error page as before.
I don’t really don’t know how to proceed, any hint please ?
Thanks
I tried several rewrite rules and all of them is working. WordPress (which relies on rewrite rules) also works perfectly which probably means that it’s on you, not the servers.
It’s on me maybe you are right but why RewriteEngine On no errors and adding a simple line RewriteBase / make it fail ?
I still have no idea what exact .htaccess rules you have been using on your website. Would you please share the actual code?
I recreated different rules and now it seems to work. I don’t really know .. rules were done by Gemini.
thanks for help btw
That’s likely your problem then. In my experience, AI seems to struggle with .htaccess rules. Even Claude which is one of the better ones for coding really doesn’t seem to get them quite right