How to activate mod_rewrite?

前端 未结 6 1499
小蘑菇
小蘑菇 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:13

    In your question, you have mentioned,

    Also, my apache2.conf file doesn't work. I tried to write som nonsense. And it is still gives me the normal result instead of http 500 error

    So, before posting more stuff to try-out with .conf files,

    run strace -o somefilename.txt sudo /etc/init.d/apache restart

    strace - trace system calls and signals : strace(1) - Linux man page.


    The -o somefilename.txt part puts the output of strace into somefilename.txt. Open the text file and search for httpd.conf. You should be able to see code similar to:

    stat("/etc/httpd/conf/httpd.conf", {st_mode=S_IFREG|0644, st_size=35894, ...})=0
    open("/etc/httpd/conf/httpd.conf", O_RDONLY|O_CLOEXEC) = 3
    

    The path to httpd.conf will be replaced by the path to your default httpd.conf

    If you find one, then open that httpd.conf and make changes there. Else, a httpd.conf is not getting loaded.

    If later is the case, try:

    sudo /etc/init.d/apache -f  /path/to/httpd.conf start
    

    Also, check for NameVirtualHost *:80 and make sure it is not commented.

提交回复
热议问题