我有我的改写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