doushuo8677 2013-12-23 23:55
浏览 35
已采纳

CakePHP 2.4.3 URL重写模块无法正常工作

Ok...

Getting tired of this issue. So I thought I would ask here

Just to clarify I did follow the Cake PHP documentation on this. I did google this for almost 2 hours and guess what ... no luck

  1. I did enable the mod-rewrite -> this took me a while as I dont have an httpd.conf file
  2. I edited my htaccess file in webroot etc to include:

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ index.php [QSA,L]
    </IfModule>
    

As recommended by another poster on this site

No Luck. Am I missing something special here like a tad of mystical unicorn dust on my installation or am I being stupid?

Lemme know if you need something else

Oh I did a LAMP installation thing a while ago

Your guidance will be much appreciated :)

[edit] cahnged tags to 2.4 instead of 2.3 <-- My bad

  • 写回答

3条回答 默认 最新

  • doupi6737 2013-12-24 12:12
    关注

    If you had to enable mod_rewrite then chances are, your default apache setup will also need to be changed to allow the .htaccess to execute correctly. By default, most .htaccess rules in publicly accessible directories will be denied.

    Depending on your setup you should have something like this ...

    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order deny,allow
        deny from all
    </Directory>
    

    Found in your config directory for a apache, which may be something like

    /etc/apache2/sites-available/default
    

    Note that the path above and also the /var/www/ path in your Directory tag above, may be different.

    You will need to change a few things, such as AllowOveride and also a few others to match below. Inspect for the differences.

    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    

    Once you have changed that, restart apache and hopefully you will see that the rules in your .htaccess file are now executing.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元