douyan9417 2011-09-19 06:46
浏览 59

Apache mod重写不适用于mac os x lion

I'm trying to set up mod rewrite on os x and it doesn't seem to be working properly.

I've edited my httpd.conf file to include the module, I've changed the AllowOverride setting to "all" in both my httpd.conf and my user.conf file.

Now when I add a htaccess file with the following:

RewriteEngine on
RewriteRule    ^$ public/        [L]
RewriteRule    (.*) public/$1    [L]

I get a 404 not found saying ...

"The requested URL /Users/matt/Sites/framework/public/ was not found on this server."

Even though that folder does exist.

The fact that it's redirecting would suggest that mod rewrite is installed and working, but I'm not sure why I'm getting a 404. Any one else had this problem?

Thanks

  • 写回答

1条回答 默认 最新

  • douche3791 2011-09-19 07:14
    关注

    I did test your rewrite rule on a Windows machine and it thrown Internal server error. I tweaked it a little bit and came to this solution and it seems to work just fine on my test environment.

    Could you give it a try and see if it's ok for you?

    RewriteEngine on
    RewriteRule ^public/ - [L]
    RewriteRule .* public/$0 [L] 
    
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料