繁体   English   中英

php雪豹上的简单mod_rewrite问题

[英]php simple mod_rewrite issue on Snow Leopard

我的htaccess页面中包含以下内容:

  <IfModule mod_rewrite.c>
   Options +FollowSymLinks
   RewriteEngine on
   RewriteRule (.*?)$
   index.php?page=$1
  </IfModule>

但这不起作用,并给我内部错误(500)。

但是,如果我注释掉最后两行,则该页面可以加载,不会出现错误,但无法达到我想要的效果。

 <IfModule mod_rewrite.c>
   Options +FollowSymLinks
   RewriteEngine on
   #RewriteRule (.*?)$
   #index.php?page=$1
  </IfModule>

任何想法,这可能是什么?

Mac雪豹。 我的目录位于DocumentRoot“ / Library / WebServer / Documents”中,我不使用普通的http:// localhost /〜User /,而是使用http:// localhost / 等等

谢谢

更新:

我回到这个问题上已经有很长时间了。 因此,请在下面找到我的新详细信息,使用这些详细信息我仍然收到以下错误:

   Internal Server Error

   The server encountered an internal error or misconfiguration and was unable to complete your request.

   Please contact the server administrator, you@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

   More information about this error may be available in the server error log.

我的网址:

  localhost/exp/index.php 

我的htaccess:

  RewriteEngine On
  RewriteRule (.*?)/(.*?)/(.*?)$
  exp/index.php?page=$1&action=$2&id=$3

如果我将“ RewriteEngine On”以外的所有内容都注释掉,则不会

  RewriteEngine On
  #RewriteRule (.*?)/(.*?)/(.*?)$
  #exp/index.php?page=$1&action=$2&id=$3

我收到403禁止消息。 我fi评论他们所有的页面加载。

我的/etc/apache2/httpd.conf文件详细信息如下:

 <Directory />
     Options Indexes MultiViews FollowSymlinks
     AllowOverride All
     Order allow,deny
     Allow from all
 </Directory>


 <Directory "/Library/WebServer/Documents/">
   Options Indexes MultiViews
   AllowOverride All
   Order allow,deny
   Allow from all
 </Directory>

我用它作为我的本地主机,而不是我的用户一个本地主机/〜用户/

所以对我的生活来说,不要知道发生了什么。

答案来自这里:在这里回答我的问题

  RewriteEngine On
  RewriteRule ^(.*?)/(.*?)/(.*?)$ index.php?page=$1&action=$2&id=$3

似乎是休息,它需要在一条线上吗?

# Turn on URL rewriting
RewriteEngine On

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php?page=URL
RewriteRule .* index.php?page=$0 [PT]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM