I'm trying to achieve:
I am using CodeIgniter.
I am trying to access http://localhost/mywebsite/uploads/. The directory exists, and via a 3rd party upload script, I can successfully write to that directory. However, when going straight to the URL (or referencing its files in an src attribute), it gives me a 404 error.
I thought the best way to do this was to:
Make sure my $config['base_url'] was set to http://localhost/mywebsite/.
(For an unknown reason, I can access /mywebsite/js/ but not /mywebsite/uploads/.)
I read the documentation and it said to:
Create a folder at the root of your CodeIgniter installation called
uploads and set its file permissions to 777.
That works to upload to, but it doesn't work to access from!
I did it, I expected to see:
Either a directory listing or permission denied page. I even tried going straight to a file, like http://localhost/mywebsite/uploads/myfile.jpg.
Instead, I saw:
404 Page Not Found
The page you requested was not found.
What am I doing wrong?
Please check your .htaccess file,
there shouldn't be any rule to restrict the access to the uploads folder.
("uploads" should not appear within this rule: RewriteRule ^(css|js|ckeditor) - [L])
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 have setup a development server for an issue(see No Input File Specified - Joomla), all is working correct now on the development server apart from no images on the site or inside the administration menu are loading.
When I try to look at them individually they are 403 forbidden.
http://37.26.108.168/~arbersho/
All directories are 755, all files are 644 and the owner is the correct one.
Is this because of the temporary URL and will this be fixed by pointing the domain over?
Thanks again
This was a htaccess issue which is fixed.
I am trying to create a custom 404 error page. The instructions that I found say to create a .htaccess empty text document when I do that Windows tells me to put a file name on it. Can someone tell what I need to do or point me to a tutorial for making custom 404 error pages?
It seems like you're just trying to make the page itself (according to the commentary on the question). To create the page just make a file of any name .html or whatever format you wish to use (.php for php for example) and write it up using your language of choice. Once you create the 404 page you need to specify it's location, assuming you're uploading this to a site of yours. This should be editable in a control panel like CPanel for example. If not, you'll need to edit your apache config to specify it's location or make and upload an .htaccess file to specify it's location.
The problem is that Windows Explorer doesn't let you create file with name .htaccess. Instead of creating the file with Windows Explorer, open a Notepad and save the file with name .htaccess. Don't forget to change "Save as type" to "All Files (*.*)", otherwise it will add .txt extension to it.
Assuming you are using Apache and .htaccess is not activated you use
# this is in .htaccess in the root directory of the webspace
ErrorDocument 404 /url/to/error/page.html
am using codeigniter 2.
when i use the below i cant get the image.
application/views/admin/images/image.png
folder structure is correct.but the image is not coming there.from view
source option i got the following
403 Forbidden
Forbidden
You don’t have permission to access /application/views/admin/images/image.png
on this server.
am on local server wamp.
if i put the image on root i can get it
but i was uing similar folder structures with codeigniter 1.7.3 those were working for me
i dont know why its not with ci2 or i mde any mistake…..
Only .php view files are supposed to exist within the /application/views directory. You should store images in a directory like /images or /assets in the web root.
there may be .htaccess file in your root what deny write.
Rename .htaccess and try again.
if it works, you may edit .htaccess