Not able to uplaod htaccess file - php

I am trying to upload my new website (codeigniter project) to the server. .htaccess file is used in my project and it is working properly in localhost. Also, i can upload the file too, but after uploading, it is not working. I always need to add the 'index.php' in url. I can't see the .htaccess file and when i trying to upload it again, it is showing the message, the file is alredy exist. Do anyone know the reason?

Try using FileZilla and enable hidden files to be visible:
Open FileZilla FTP client.
From the Menu bar choose Server
Select Force Showing Hidden Files which should be the last option.
One other thing to check is if you're using Apache or Nginx because Nginx does not support the .htaccess file

I am using winSCP(FTP software) to upload my .htaccess. As you mentioned you are not able to view it. However when you try to create a new file through winScp, the file will be automatically loaded to your text editor.
I am not sure if other FTP software works the same.

The file exists, but is hidden.
Probably the user on whose log does not have permission to replace him.

remove .htaccess file from your server , but before make sure that that file is no more useful for you .
other way
open the hosting server .htaccess file in online editor of cpanel
now copy past your htaccess file codes which required to be change.

As mentioned in the comments, it could be that the server is running for example Nginx instead of Apache.
However, I think the most likely cause for the .htaccess file not having an effect is a configuration issue. It could be that .htaccess functionality is disabled either in config you can manage, or in the server's config.
Contact your webhost to resolve this issue.

Related

PHP File Upload No Longer Working, No Changes Made (Plesk Hosting)

I have a web app built with angular and PHP that has been established and running since 2016. There is a file upload feature that will upload a file from client-side app to a directory on the server. I noticed the upload is no longer working. Nothing has changed on our end with the configuration of server/hosting or front-end application. The directory still exists and can successfully list files from the front. I get an internal server error when trying to upload with the code below. Very simple example and nothing to indicate this code no longer works. I have file-uploads = on in the php.ini file. It is hosted on GoDaddy. I have checked the error logs and can see that the request is failing but with no detail. Is anyone aware of what may be causing this? I can provide more detail, if thought necessary.
<?php
$target = '../images/attorney_photos/'.$_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'], $target);
print('/assets/images/attorney_photos/'.$_FILES['file']['name']);
?>
If your file upload is on then check for
upload_max_filesize
and
post_max_size
in your php.ini file and also if you want to upload more than a specific limit each request, then check
max_file_uploads
to be more than files you want upload.
Also it's better to use a tested library for upload your files. you can search for codeguy/upload in packagist and install it with composer for advanced usage or if you no need lots of options you can download this file from github that is so simple, easy to use and well written.
I hope this helps :)
login to plesk administrator panel then goto Domain->Website->PHP Settings
Change upload_max_filesize from "2MB" to "16MB"
Save and try uploading again.

Bypass htaccess file restriction

So, I was trying to upload PHP files into Apache server, and whenever I browse the file I get 403 error due to htaccess limitations. It turns out that the server only accepts certain files such as "gif|jpg|png|mp4" and other image files.
Is there any way to bypass this?
NOTE **: I tried the old ways,**PHP, Phtml .. it didn't work.
Is there any way to bypass this?
Not unless you edit the .htaccess file or find a vulnerability in Apache.
Note that simply uploading a PHP file doesn't mean the server can execute it. The server needs to have the right software installed and Apache needs to be configured to handle PHP files. You can't just drop a PHP file in there and expect it to work, regardless of what the .htaccess file says.

How to disable all file uploads to a server?

Is there a way, through php.ini or .htaccess to disable all file uploads to a server?
The only catch is, I want to have one folder (example an admin folder) to still have access to upload.
I am thinking along the lines of when you disable eval and exec.
This question stems from the fact that I have seen sites infected with malware, which are located in all random spots through the server - a recent example I have seen is something similar to:
eval(gzinflate(base64_decode("HZ3fdsfHjtfvdqlkdsfabf5Y7OAQfMCRc9YKaYc5o0mHOmmJ6+ .... ));
Located in a file called stp.php on a server. My thinking is that if the sites users need no access to upload files (which they don't), then it should be simply disabled.
Yes. In your php.ini file set file_uploads=Off as described here.
This will disable all file uploads through HTTP.

url rewriting mystery

I have copied a project from a server to my local machine.
The site appears to be using url rewriting, so I have turned on rewriting_module in WAMP/Apache.
However, there is no .htaccess file in the project. Cannot figure out how the url rewritting is being achieved and so I can't make it work on my local machine.
Make sure your FTP client show hidden files
If not, configure the client so it displays hidden files —refer to your FTP client documentation— and then copy it to your local machine
If it already does or if you have copied the project with SSH, take a look at the remote apache configuration files (I'd look at virtual hosts) and compare with your local configuration.
This is an example of how to configure CyberDuck FTP client :
.htaccess file is hidden file, make your folder view option to show hidden files.
OR
Is the project done in any frame work, that is codeigniter, zend or cake etc, in that case it will be having its own url structure in codeigniter url will be like this : http://domain.com/controller/function

DreamWeaver with PHP

Greetings ! I have a project that has php index.php file in /htdocs. Also include files like dboperaitons.php, config.php and css file also in /htdocs/themes. Now I set up New site in dreamweaver opened the index.php file, it is running fine , but when I click on properties and ry to add or modify css property from dreamweaver, it gives me error saying unable to open file http://localhost/themes/en.css file because it is not found in the hard disk.
1. Why is it searching for file as http://localhost instead of c:/xampp/themes.
2. It says en.css file is remote file and cannot be edited.
How can I resolve this. Please guide.
you can fix this problem by browsing the file manually from its location.
When you define a site in Dreamweaver you need to make sure you set up both the local and remote locations in order for it to know where files are. It sounds like you have not defined the local site folders properly and DW is confused about where things go.

Categories