现代重写是给我一个困难时期 [英] Mod Rewrite is giving me a hard time

查看:102
本文介绍了现代重写是给我一个困难时期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用我瓦帕在Windows 7我想显然清洁我的网址。我试图找到当前语法并没有什么,但我还没有计算出来。

I'm currently using wamp on windows 7. I'd like to clean my urls obviously. I've tried to find the current syntax and what not, but I haven't figured it out.

我的路,现在为localhost / RS / index.php的
当我去到localhost / RS /用户它给了我一个404的,但本地主机/ RS /给我的index.php页面。

My path right now is localhost/rs/index.php
When I go to localhost/rs/user it gives me a 404, but localhost/rs/ gives me the index.php page.

这是我在WAMP的www目录我的.htaccess文件。

This is what I have in my .htaccess file at the www directory of wamp.

RewriteEngine On
RewriteRule ^/$ index.php
RewriteRule ^/([a-z]+)$ index.php?page=$1
RewriteRule ^/([a-z]+)/$ index.php?page=$1

我已经取消注释行

I have un-commented the line

LoadModule rewrite_module modules/mod_rewrite.so

在Apache中的httpd.conf文件

in the httpd.conf file of Apache

什么是错?就是在错误的地方我的.htaccess文件?是我的语法错误?

What's wrong? Is my .htaccess file in the wrong spot? Is my syntax wrong?

谢谢!

推荐答案

的.htaccess / RS 文件夹,并尝试

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9]*)/?$ index.php?page=$1 [L]

希望这将有助于

Hope this will help

这篇关于现代重写是给我一个困难时期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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