I'm trying to set a site live. The site works perfectly fine on a live dev server which we've been using to show the site to the client. Here is the htaccess from the live dev (works fine):
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
#RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Rewrite to 'public' folder
RewriteCond %{HTTP_HOST} ^livedev.domain.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) public/$1 [L]
</IfModule>
AuthType Basic
AuthName "dev16"
AuthUserFile "/home/site/.htpasswds/public_html/passwd"
require valid-user
And here's the .htaccess from the live site:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
#RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Rewrite to 'public' folder
RewriteCond %{HTTP_HOST} ^livesite.co.uk$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) public/$1 [L]
</IfModule>
The 2 are identical except for the HTTP_HOST and the removal of the authentication.
It gives me a generic "Internal Server Error".
I have tried deleting the contents of .htaccess which just gives me page not found so the issue definitely lies in .htaccess.
A total .htaccess virgin, what steps can I take to find the cause of the issue?
Thanks
(It's Laravel 3.2.13)
The framework ships with a public/. htaccess file that is used to allow URLs without index. php . If you use Apache to serve your Laravel application, be sure to enable the mod_rewrite module.
htaccess file for redirecting to Laravel's public folder. In Laravel the path for serving your web page is in the /public folder. By default after installing Laravel and navigating in a browser to the URL you will see a directory listing of all the Laravel files.
htaccess (Hypertext Access) file is an Apache distributed server configuration file. You can use the . htaccess file to set server configurations for a specific directory. This directory can be the root directory of your website or another subdirectory where the .
Use at same level of /public
This way first redirect to public
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
And inside /public
then, you handle index.php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With