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条)

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)