使用mod_rewrite与XAMPP和Windows 7 - 64位? [英] using mod_rewrite with XAMPP and windows 7 - 64 bit?

查看:213
本文介绍了使用mod_rewrite与XAMPP和Windows 7 - 64位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的mod_rewrite规则允许我再直接是不实际的文件或目录的index.php文件的任何请求。

 选项+ SymLinksIfOwnerMatch
    RewriteEngine叙述在
    的RewriteCond%{} REQUEST_FILENAME!-f
    的RewriteCond%{} REQUEST_FILENAME!-d
    重写规则。的index.php [L]

在PHP文件,我把这个简单的code来处理这个导航

 < PHP
$ navString = $ _ SERVER ['REQUEST_URI']; //返回/ mod_rewrite的/编辑/ 1 /
$部分=爆炸('/',$ navString); //突破到一个数组
//让我们看一下项目的数组,我们有:
的print_r($部分);
?>

我的开发环境是XAMPP和Windows 7 - 64位
httpd.conf文件

 <目录/>
    有FollowSymLinks
    所有的AllowOverride
    为了否认,允许
    所有拒绝
< /目录><目录C:/ XAMPP / cgi-bin目录>
    所有的AllowOverride
    选择无
    为了允许,拒绝
    所有允许
< /目录>

我的问题是当过我传递任何varible的纸条例如:

 的http://的locahost /测试/ somethinghere / andhere

它重定向我是

本地主机的默认页面

 的http://的locahost / XAMPP


解决方案

解决
我刚才添加的文件夹到的.htaccess并删除选项+ SymLinksIfOwnerMatch

 的RewriteBase /测试/

i have a simple mod_rewrite rule which allow me to re-direct any requests that are not actual files or directories to the index.php file

    Options +SymLinksIfOwnerMatch 
    RewriteEngine On 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

in PHP file i put this simple code to handle this navigation

<?php
$navString = $_SERVER['REQUEST_URI']; // Returns "/Mod_rewrite/edit/1/"
$parts = explode('/', $navString); // Break into an array
// Lets look at the array of items we have:
print_r($parts);
?>

my development environment is XAMPP and Windows 7 - 64 bit httpd.conf file

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
</Directory>

<Directory "C:/xampp/cgi-bin">
    AllowOverride All
    Options None
    Order allow,deny
    Allow from all
</Directory>

my problem is when ever i pass any varible to the scrip for example

http://locahost/test/somethinghere/andhere

it redirect me to the local host default page which is

http://locahost/xampp

解决方案

Solved i just added the folder to the .htaccess and remove Options +SymLinksIfOwnerMatch

RewriteBase /test/

这篇关于使用mod_rewrite与XAMPP和Windows 7 - 64位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆