Setting up .htaccess with apache and laravel

时间:2015-10-30 23:52:59

标签: apache .htaccess laravel mod-rewrite

This seems to have been asked hundreds of times, and I read it and tried different things. Nothing seems to work, so after reading about 5 google pages about this I gave up and I want to see if anyone can give me an answer. I want to remove the /public from my URL I'm using an apache 2.4 server on windows. I just installed laravel. I made sure the rewrite module is on in apache (php's get_apache_modules() shows it) and now I'm trying to write the .htaccess - and I can't understand how it works. I don't want to change anything in my apache configurations (I'm using this machine to develop multiple apps) my current .htaccess files are : in the app route directory Options -MultiViews RewriteEngine On RewriteRule ^ public/index.php [L] and in the public folder Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ /texteditor/public/index.php [L] Right now localhost/texteditor/ - and anything after it that isn't public/ gives me 404 Also can anyone recommend an easy .htaccess tutorial for dummies?

1 个答案:

答案 0 :(得分:0)

我做了这件事,做了以下工作并且工作正常。 如果对你有帮助,请这样做。

  1. public/index.php移至www/texteditor/index.php
  2. 同时将public/.htaccess移至www/texteditor/.htaccess
  3. 然后你可以做到。

    请将您的应用根目录的.htaccess替换为public/.htaccess