开发者

Apache mod rewrite not working on mac os x lion

开发者 https://www.devze.com 2023-04-06 06:57 出处:网络
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 bot

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 f开发者_如何转开发ollowing:

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


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] 
0

精彩评论

暂无评论...
验证码 换一张
取 消