I am facing a problem with a project recently. The site is running locally fine. Like if I browse the site its showing me the page also if I do some thing like "localsite.dev/students" it is also showing the page. But if I type "localsite.dev/students:auth", I am getting "Access forbidden!". I am using XAMPP in Windows 8. Here is my configuration:
Apache Version Apache/2.4.10 (Win32) OpenSSL/1.0.1t PHP/5.6.24
PHP Version 5.6.24
Is it a problem with the .htaccess file or any Apache settings problem. Please let me know. The .htaccess file that I am using is like following:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Please help me. I have already spent a lot of time with it. Thanks in advance for any kind of help.
Apache runs as the "nobody" user by default, it might have permission to browse your [OSX/Win] user directory or some of its subdirectories.So, you will receive "access forbidden" error when you try and view your development site. Another scenario will be that you might find that you are able to view your dev site, but PHP throws errors when you attempt to write files or make directories on the filesystem.
So, to fix this you can configure Apache to run as your [OSX/Win] user. Open httpd.conf and look for following lines:
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User nobody
Group nogroup
Change this to:
User Username01
Restart Apache and you are now good to go to navigate your site without any issues, including manipulating files and folders using PHP.
Refer the link for reference:
Virtual Hosts in xampp
Hope It helps you.
Related
I have hosted my site on aws through ftp,
now when i access this
url : http://X.XXX.XXX.X/projectfoldername/
i can access the page after i use
http://X.XXX.XXX.X/projectfoldername/public
but i want to remove public changed htaccess file also but when i upload it on cpanel it is working.
.htaccess file :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
</IfModule>
Any help is highly appreciated
Nearly all Linux OS's have a .conf file that you can use to tell it which folder is the public folder. This needs to be updated for Laravel to work.
From here (https://bobcares.com/blog/cpanel-change-root-directory/), for cPanel:
4. Updating cPanel files
cPanel/WHM does not have an option to change the document root of the main domain via any interface. By default it is the public_html folder in the user home directory.
In certain rare scenarios, we have customers who want their document root to be changed to another folder than public_html.
This has to be done from the backend by updating the cPanel user account file at /var/cpanel/userdata/username/domainname .
The following parameters are updated with the desired directories.
documentroot: /home/steinknu/public_html
scriptalias:
-
path: /home/steinknu/public_html/cgi-bin/
For sites with SSL installed, the configuration file for SSL is also updated accordingly.
This file is available at the location /var/cpanel/userdata/username/domain_SSL .
After making the changes, the user data cache is updated and Apache configuration file is rebuilt to reflect the changes in the corresponding files.
The Apache and PHP-FPM services are restarted and we verify the relevant configuration files to ensure that they are all updated properly.
I am deploying my Laravel application to the AWS ElasticBeanstalk. I have deployed it. This is how I deployed it. I created an environment. Then I set the Document Root as '/public'. Then I deployed my application by running "be deploy" command. The application has been deployed successfully. But there is an issue with my application. If I want to access the route for example, I have to access something like this.
http://myan-eat-test.eu-west-1.elasticbeanstalk.com/index.php/contact-us
as you can see, I have to put in index.php. If I do this, http://myan-eat-test.eu-west-1.elasticbeanstalk.com/contact-us, it does not work.
I tried created a .htaccess file with the following content in the root folder either.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
It does not work. How can I fix it?
Default proxy server is nginx in elastic beanstalk to use apache which is the only server keeping your .htaccess in mind you need to add a .ebextensions/apache.config file with:
option_settings:
aws:elasticbeanstalk:environment:proxy:
ProxyServer: apache
See also:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-specific.html#command-options-docker
I'm trying to set up CakePHP 2.x in Cpanel (Hostmonster) while the domain of the site is still pointing to the older server. In order to pull up the site without the domain (for demo), I have to use http://[hosting-IP-address]/~mysite.
This is my default .htaccess file located in the root (the one before app/ folder):
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
If I leave it as it is, I get 404 error. When I remove the .htaccess file or leave it blank, the site content loads, but without CSS. The site files are located in /home2/mysite/public_html/ folder. I tried adding RewriteBase with different combinations (~mysite, mysite, mysite/public_html), but no avail.
I have tried with rewrite base setting then i get 500 internal server error. Please suggest
Instead of changing your site .htaccess code. I will suggest you update your local pc host file to point your site to new server, so that you can check your all URL.
Open your hosts file which is located at : c:\Windows\System32\Drivers\etc\hosts and add the following code with your new hosting IP address
hosting-IP-address www.domain.com
hosting-IP-address domain.com
I uploaded my code with Laravel 4.2 on a hosting share with settings.
When I go to the home page or any page on my website. I see a white page , no error nor message.
I set 'debug' => true and 777 for permissions of app/storage
My .httaccess is :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
The databese was created and the tables were imported.
Please help me! My website URL is: larintravel.com.
In the past, configuring a local PHP development environment on your machine was a headache. Installing the proper version of PHP, required extensions, and other needed components is time consuming and confusing. Instead, consider using Laravel Homestead. Homestead is a simple virtual machine designed for Laravel and Vagrant. Since the Homestead Vagrant box is pre-packaged with all of the software you need to build robust PHP applications, you can create a virtualized, isolated development environment in seconds.
http://laravel.com/docs/quick
I started working on a project in the mid. We are using Zend Framework, PHP, MySql, Ajax, jQuery and jSon on Ubuntu. It was working on ubuntu.
Now I switched to Windows. I installed Wamp, Eclipse and create a host(test.dev) on windows for my project. But when start the project by test.dev. it give me the following error on browser windows:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin#localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
then i deleted the public/.htaccess file and try again. This time no error is displayed but browser page is blank. I checked the firebug(mozilla browser) and there is no response in consol.
My .htaccess file is like that:
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Can someone tell me that what problem may be and how to solve this. If you need some other information then tell me what type of information required for you to solve this.
Thanks
A 500 - Internal Server Error is often caused by something incorrect in a configuration file.
Considering it works (i.e. no error) when you delete the .htaccess file, there's probably something in it that causes troubles.
As a first idea (as there is not much in yours, except rewrite rules), are you sure that mod_rewrite is enabled ?
You can check this in your Apache configuration : there should be a line like this one :
LoadModule rewrite_module modules/mod_rewrite.so
If this doesn't help, do you have any error message in Apache's error_log file ?
The .htaccess file looks fine. My bet is the mod_rewrite module is not activated in your local Apache. Check out your httpd.conf file..
Take a look into Apache's error.log file first. It will give you detailed information about the 500 error and its cause.
What Pekka and Pascal said is right, but you can take a look to if mod_env module is loaded in your Apache configuration so you can use the SetEnv directive.
I have this same problem when I put an application in production. To my surprise, this module is not enabled in some installations.