douyouzheng2209 2013-05-19 03:51
浏览 44
已采纳

Godaddy Ubuntu 3.6 mod_rewrite问题

I have been at this for 3 hours and cannot seem to get mod_rewrite to work with GoDaddy on a shared server under a subdomain. I have an app in a subdirectory and I've used the same rules before on multiple servers so I know they work. Here's what I've got:

PHP Version 5.3.10-1 Ubuntu3.6

subdomain root/
-.htaccess
--appdir/
---.htaccess
----public/
-----.htaccess

subdomain root/.htaccess

Options -Multiviews

That's it for the document root .htaccess, many have suggested to do this with GoDaddy servers.

appdir/.htaccess

Options -Multiviews

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

This routes all requests to the appdir/public directory

appdir/public/.htaccess

Options -Multiviews

RewriteEngine On
RewriteBase /appdir/public ### also tried just adding /appdir ###
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

ErrorDocument 404 index.php

Just to be sure mod_rewrite was available, I ran sudo a2enmod rewrite from Bash and checked after restarting apache with print_r(apache_get_modules()); and sure enough it's there so needless to say I'm at a complete loss as to what the problem may be. Anyone have similar experiences with GoDaddy and have suggestion on what to do to get mod_rewrite running? Thanks in advance.

  • 写回答

1条回答 默认 最新

  • duanjiao6731 2013-05-19 04:15
    关注

    From a default ubuntu install to get up and running with mod_rewrite you have to :

    Enable mod rewrite

    a2enmod rewrite
    

    Then make sure you are allowing overrides in the site config (/etc/apache2/sites-available/) and update the line AllowOverride All in the '' directive.

    reload apache config

    service apache2 reload
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 关于用python写支付宝扫码付异步通知收不到的问题
  • ¥50 vue组件中无法正确接收并处理axios请求
  • ¥15 隐藏系统界面pdf的打印、下载按钮
  • ¥15 MATLAB联合adams仿真卡死如何解决(代码模型无问题)
  • ¥15 基于pso参数优化的LightGBM分类模型
  • ¥15 安装Paddleocr时报错无法解决
  • ¥15 python中transformers可以正常下载,但是没有办法使用pipeline
  • ¥50 分布式追踪trace异常问题
  • ¥15 人在外地出差,速帮一点点
  • ¥15 如何使用canvas在图片上进行如下的标注,以下代码不起作用,如何修改