Domanda

as of title, I'm having problems with my .htaccess file, everything should be set fine, but has I write something as basic as

RewriteEngine on

it starts giving me that nice 500 Internal Server Error. I'm hosting on localhost on an Apache server (UNIX)

Obviously I triple checked that everything is set fine, and top of all that mod_rewrite is loaded.

Thanks for your precious help!

È stato utile?

Soluzione

If the error occurs for every single type of instruction you put in the file (that is, caching, FilesMatch, ErrorDocument, etc), there are two possible options that I can think of right now:

  1. The encoding of your .htaccess file is not compatible with the server you're running. Try converting it to ANSI, and then try again (Apache does not support Byte Order Marks, so you'd need to save it to ANSI, or UTF-8, without the BOM). If that does not work:

  2. AllowOverride is not set correctly, or not at all. If you have access to the Virtual Host/Directory configuration, you'll need to enable it by adding the line AllowOverride All in the <Directory> container.

Altri suggerimenti

When you try to remove the code RewriteEngine on and the URL remapping or the URL redirecting is still functioning well, then you do not have to put that code in your .htaccess file, for your HTTP server was already configured that the rewrite engine is on. But if you've tried to remove it and the rewriting or the redirecting stop, then you must include all your .htaccess codes in your question. Then if it's empty, then why you need to turn the RewriteEngine on if you're not going to apply even a single RewriteRule?

Have you ever tried this:

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^notexist.html$ /index.html

And try to visit yourdomain.com/notexist.html if it's URL remapping into /index.html.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top