的.htaccess ModReWrite帮助 [英] .htaccess ModReWrite help

查看:172
本文介绍了的.htaccess ModReWrite帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的改写code一些麻烦。请注意,.htaccess文件是子域中的文件夹(...的public_html /子域/)

I am having some trouble with my ReWrite code. Please note that the .htaccess file is in the subdomain folder (...public_html/subdomain/ )

我只是试图重写一个页面请求:

I am simply trying to rewrite a page request:

http://subdomain.mysite.com/home
http://subdomain.mysite.com/index.php?page=home

我的.htaccess文件看起来像这样...

My .htaccess file looks like this...

RewriteEngine On
RewriteRule ^/([A-Za-z0-9\-\_])$ /index.php?page=$1

做任何事情跳出你?

Does anything jump out at you?

推荐答案

您当前的规则可能适用于URL的一个字符(斜线后)!

Your current rule probably works for urls one character long (after the slash)!

添加 + 来表示一个或多个字符,或一个 * 零个或多个

Add a + to signify one or more characters, or a * for zero or more

尝试

RewriteEngine On
RewriteRule ^/([A-Za-z0-9\-\_]*)$ /index.php?page=$1

这篇关于的.htaccess ModReWrite帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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