Apache 在本地主机windows xampp上配置mod_rewrite
我正在尝试让mod_rewrite在localhost上工作。如果我转到localhost/website,它将加载Apache 在本地主机windows xampp上配置mod_rewrite,apache,.htaccess,mod-rewrite,xampp,Apache,.htaccess,Mod Rewrite,Xampp,我正在尝试让mod_rewrite在localhost上工作。如果我转到localhost/website,它将加载 DirectoryIndex home.php 及 也有效 但对于其他页面,它只显示主页 RewriteEngine On RewriteBase / RewriteRule ^home/?$ home.php [NC,L] RewriteRule ^about/?$ about.php [NC,L] <--- this goes t
DirectoryIndex home.php
及
也有效
但对于其他页面,它只显示主页
RewriteEngine On
RewriteBase /
RewriteRule ^home/?$ home.php [NC,L]
RewriteRule ^about/?$ about.php [NC,L] <--- this goes to home
重新编写引擎打开
重写基/
重写规则^home/?$home.php[NC,L]
重写规则^about/?$about.php[NC,L]您在浏览器中输入的确切URL是什么?此.htaccess位于何处?localhost/website/about和htaccess位于C:/xampp/htdocs/website文件夹您需要使用此URL:http://locahost/about
好的,可以了,因此,如果我想使用localhost/website/about,我是否需要将ServerName更改为localhost/website?为此,您需要更改DocumentRoot
和
RewriteEngine On
RewriteBase /
RewriteRule ^home/?$ home.php [NC,L]
RewriteRule ^about/?$ about.php [NC,L] <--- this goes to home
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs/website"
<Directory "C:/xampp/htdocs/website">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>