When I place a Laravel project into Apache's document root, say /var/www/html, it works when I point a browser at it.
However if I put it under a directory under Apache's document root, for example /var/www/html/myProject, it doesn't work when I point a browser at it.
Is there anyway I can change this behavior?
Thank you very much.
Edit:
When I put the Laravel project off a sub-directory off /var/www/html, Laravel complained that it could not write to the file laravel.log. After checking and changing the group ownership of the sub-directory, the index page came up normally.
However, the background image was missing, even after I changed the URI in the CSS stylesheet.
Furthermore, when I clicked on any link from the index page, I got a 404 Not Found Error. This is an Apache 404 and not a Laravel 404, which is styled differently.
OTOH, if I run the PHP server off this sub-directory and point my browser at localhost:8000, the links serve up pages correctly.
Thank you for your help.
Related
I have recently finished building my website and since I didn't know how to put it online I decided to follow this tutorial: https://youtu.be/tq7dqdHCc7U
Everything worked fine until I tried to upload my .html files. I copied them into a www folder I created, but when I try to access the site with myIP/~username, I get a 404 error page. What am I doing wrong?
I guess you have put html file in wrong directory. Please put a sample index.html in root directory and in public_html folder. and try to access with domain name. it should work
A 404 error means that a valid page wasn't found. The only html file that apache know to render automatically is an index.html file. That's the default for the root url (in your case: yourIP/~username). So to fix the problem, you can either change what apache looks for in a index page in your httpd.conf, rename one of your files to index.html, or just append the name of a file that does exist to the end of your URL: yourIP/~username/myPage.html
Actually, in my localhost, my website run without any problem.
However, in the living server, there are some problem of showing image.
If I put image in the web root, image can be showed in web. But if I put image into folder, image can't be showed.
Example:
/post/1/1.jpg
If I click the link directly:
http://website/post/1/1.jpg
it will be error 403. As below:
Forbidden
You don't have permission to access /post/1/1.jpg on this server.
Server unable to read htaccess file, denying access to be safe
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Discover some hints:
If I put all files into the web root, including codeigniter framework itself.
The website run without any problem.
However, it is not the good practice. Actually, I want to put the codeigniter framework out of the web root.
Open your FTP via Filezila or any other program. navigate to your root folder and find the folder /post/ right click on it and change the select File Permissions... change it to 755 and re view the image in the browser.
Thanks for all reply.
I find the solution.
1) codeigniter framework can place out of web root without changing .htaccess file.
2) folder of image should be place under web root.
3) make sure the folder of image are 755 / 777 file permission.
I just built a site using Xampp and it worked great. I just transferred my site (that I used to develop by updating to live server) to localhost, and it isn't working right at all.
The images do not show and the pages are not refreshing properly.
I had to change the CSS images to /folder/x instead of just x, which I can understand I guess, but why are my HTML images suddenly not working?
One of the pages, the paths are even absolute, but the page just isn't updating even though it's saved in the local folder.
What gives? All I did differently was added a password to root user in MySQL and tried (and failed) at some mod_rewrites, which I removed.
It points the images from localhost/ instead of localhost/folder, even adding folder/x doesn't work.
You probably forgot to convert a link or made a mistake.
Remember that /images/x.png means that it's trying to find the folder images from root and not from the current folder your site is located in. Try using ./images/x.png instead.
Perhaps you could post an example from your site?
Try looking at the Apache access logs and see whether you can find a request for an image with the wrong path.
I have recently moved my joomla site to another hosting. But now the site doesn't work. Shows blank page. Though the administrator's page (/administrator) is shown and works correctly. Have any ideas for what reason it can be?
Remove the .htaccess altogether
clear the cache and tmp folders
make sure db name, login and password are correct in the configuration.php
make sure the server path (tmp and logs folders) are correct
if you still get an empty page, make sure you're looking at the right log file. Turn php error logging on or display them.
post some more details here...
I have to do some modifications online on my website, and I don't want the users to see those pages. So I renamed index.php to index_orig.php and I put another index.html that show a message (WebSite under construction) for my users.
My problem is that I want to access online to the rest of my pages to check the modifications until satisfaction, but when I try to access the rest of the pages by their whole URL (404 error is shown).
Example : www.mywebsite.com/floder1/pagetarget.php.
Put back index.php.
In your global configuration, set the site to offline and put up a message and a logo etc (assuming you are on 2.5 or 3). You'll be able to login and see the site.
Please keep in mind that in a database driven cms there are not pages in the way that you would think of them in a static html site. Everything gets pushed into the index.php of your template file.
Update the directory default document on whatever webserver you are using. Also update any rewrite rules that may be pointing to index.php