How to activate mod_rewrite?

前端 未结 6 1492
小蘑菇
小蘑菇 2020-12-16 19:17

I know that this question have been asked several times. But I can\'t get it to work.

I installed Apache2 in my Ubuntu server I can also confirm that mod_rewrite is

6条回答
  •  佛祖请我去吃肉
    2020-12-16 20:03

    All suggestions from Niels Bom are the smartest ones (I think). But I would add this as the first suggestion: try to launch and stop apache via the Ubuntu command: then when it's supposed to be stopped, make sure it's stopped ie verify your local page doesn't show anymore.

    • read what's in the folder /etc/apache2/. There should be apache2.conf conf.d envvars httpd.conf mods-available mods-enabled ports.conf sites-available sites-enabled
    • then if everything is ok, take a look at mods-enabled where you will find if the mods are enabled if so, then you can go on, otherwise take a look at the other answers about enabling modrewrite
    • take a look at sites-enabled: it's where you can find the sites that are... (guess what?) enabled. There should be the default website.
    • if so, open this file, and try to put apache nonsense in it, restart the server and see if it's happy or not. If it's not happy that's good. If it's happy then you're working on the wrong file
    • last: try to check what are the authorisations for htaccess files for this default vhost. Here's the way they work: if Apache doesn't find any directive in the vhost file, it will apply the global configuration. So I'd suggest to add the configuration in your vhost file, between the - tags (of course).

    Please tell me what's going on and I'd be glad to update my question accordingly.

提交回复
热议问题