Mod rewrite 在XAMPP中使用Mod Rewrite

Mod rewrite 在XAMPP中使用Mod Rewrite,mod-rewrite,xampp,Mod Rewrite,Xampp,我已经学习了一些关于如何使用Mod_Rewrite的教程,但没有成功 我有一个php索引页面,它采用如下页面参数: call: index?page=name1, name2, name3 etc. <?php if (isset($_GET['page'])) { switch($_GET['page']) { case 'front': include "front.php"; break; default:

我已经学习了一些关于如何使用
Mod_Rewrite
的教程,但没有成功

我有一个php索引页面,它采用如下页面参数:

call: index?page=name1, name2, name3 etc.

<?php

if (isset($_GET['page']))
{
    switch($_GET['page'])
    {
       case 'front':
       include "front.php";
       break;

       default:
       break;
       }
}
G:\xampp\apache\conf\extra\http.v-hosts.conf

line 122: LoadModule rewrite_module modules/mod_rewrite.so
line 188: DocumentRoot "G:/xampp/htdocs"
line 198: #default
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

line 215:  <Directory "G:/xampp/htdocs">
line 228:  Options Indexes FollowSymLinks Includes ExecCGI
line 235:  AllowOverride All

# cgi
line 355:
<Directory "G:/xampp/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory> 
<VirtualHost *:80>
DocumentRoot G:/xampp/htdocs/
ServerName localhost
ServerAdmin admin@localhost

<Directory "G:/xampp/htdocs/localhost/">
Options Indexes FollowSymLinks
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost> 

<VirtualHost *:80>
DocumentRoot G:/xampp/htdocs/site2/
ServerName site2.localhost
ServerAdmin admin@site2.localhost

<Directory "G:/xampp/htdocs/site2.localhost/">
Options Indexes FollowSymLinks
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

mod_rewrite只能重写/重定向请求。因此,您实际上必须在外部使用
/foobar
,并请求
/foobar
让mod_在内部将其重写为
/index.php?page=foobar
。这是人们对mod_rewrite如何工作的一个常见误解。

所以Gumbo如果你键入site.com/foobar,或将其链接到url,mod_rewrite会在内部调用/index.php?page=foobar,而site.com/foobar就是url中的全部内容?关于如何在不重写mod_的情况下实现我的原始目标,有什么建议吗?也许是通过php?@rrrfusco;那么,只需链接到
/foobar
,而不是
/index.php?page=foobar
IndexIgnore *

RewriteEngine on
RewriteRule ^([^/\.]+)/?$ /index.php?page=$1 [L]