Why is my .htaccess file redirecting to full server path instead of relative path?

前端 未结 3 1140
别跟我提以往
别跟我提以往 2021-01-19 12:18

I\'ve never had a problem with cakePHP before, but something\'s odd about this server and is causing the redirects in the .htaccess files to behave oddly.

CakePHP us

3条回答
  •  不思量自难忘°
    2021-01-19 12:52

    The solution to your question can be found towards the bottom of this page in the cakephp book:

    For many hosting services (GoDaddy, 1and1), your web server is actually being served from a user directory that already uses mod_rewrite. If you are installing CakePHP into a user directory (http://example.com/~username/cakephp/), or any other URL structure that already utilizes mod_rewrite, you'll need to add RewriteBase statements to the .htaccess files CakePHP uses (/.htaccess, /app/.htaccess, /app/webroot/.htaccess).

    I've deployed CakePHP from my profile's public_html folder as well. I had to change 3 the same .htaccess files mentioned above. Just add RewriteBase /~username/ to the .htaccess files just after RewriteEngine on!

提交回复
热议问题