XAMPP .htaccess mod_rewrite not working

前端 未结 1 839
星月不相逢
星月不相逢 2021-01-21 00:54

I am running XAMPP for Windows 5.6.11. I have the following PHP file:

C:\\xampp\\htdocs\\www.johndoe.com\\index.php

which I am accessing as

1条回答
  •  后悔当初
    2021-01-21 01:36

    As it turns out, with the default XAMPP configuration there is no need to C:\xampp\apache\conf\httpd.conf, hence no need to restart Apache as we are just making changes to C:\xampp\htdocs\www.johndoe.com\.htaccess. As this post on RewriteBase explains, we do not need RewriteBase since we will not use absolute paths in the destination links for .htaccess rules. Since relative links in these destination rules will be relative to the directory we are serving out of, we need delete the www.johndoe.com directory from the rule, as follows:

    • Place the .htaccess in ``C:\xampp\htdocs\www.johndoe.com`.
    • Place the following rewiterule in it:

      RewriteEngine on
      RewriteRule ^about/?$ index.php?value=about
      

    0 讨论(0)
提交回复
热议问题