When I go to Options->Permalinks and update my permalinks, ".htaccess" did not appear. I tried to put a blank .htaccess file manually. Then go to Options->Permalinks and update again my permalinks. But the .htaccess file is still empty.
The PHP process must be able to write your file, so you have to check the file permissions. You can do this using your FTP tool or on the command line (chmod command), if you are on UNIX.
File permission for .htaccess files is usually set to 644.
Related
I am using WordPress, I have to hide WP-includes, and WP-content/uploads from WordPress. I have tried to add the below code in htaccess
Options -Indexes
Also, I have referred to this link but still, it's not working for me.
The below link is working
http://localhost:8080/wordpress/wp-includes/
but if I add then I can see all the files. Same for the upload folder
http://localhost:8080/wordpress/wp-includes/assets
http://localhost:8080/wordpress/wp-content/uploads/2022/01
Note-localhost is just an example
Where does the .htaccess file exist on the server? Which path?
Are you sure your web server is processing this file? Are you indeed running Apache?
As long as you have a file named .htaccess (no spaces), and it's placed in your root HTML folder, or within both wp-includes and wp-content folders, and somewhere within the file on its own line, you have Options -indexes, this should be respected for all subfolders and turn off auto-indexing. Can you share the entire contents of this file, perhaps you have placed this line somewhere it's not being read.
After some research, I have created a .htaccess file in the wp-content/uploads and added the below code. And it's started working
# Kill PHP Execution
<Files ~ ".ph(?:p[345]?|t|tml)$">
deny from all
</Files>
I accidentally deleted htaccess file.
I downloaded it before I did so and then afterwards I re-uploaded it to my public_html folder, but I can't get to the WP login anymore. It just gives me a 404 error.
Why doesn't it start working when I just re-upload?
Nevermind, I figured it out. It was simply because when I downloaded the file, the period in front of ".htaccess" was removed. When uploaded, it was still removed. However, I simply edited the file name in cpanel from "htaccess" to ".htaccess" and it started working again.
After mysteriously losing site administrator access to my wordpress installation, I tried uploading the theme into the wp-content/themes folder directly.
However, I get the following error when attempting to access the main page now
{"success":"-1","alert":"Cannot write style-custom.css file, you may try setting the style-custom.css file permission to 755 or 777 to solved this. ( If file does not exists, you have to create it yourself )"}
How can I solve this?
Thanks
I have the same problem with the bluediamond themes.
To fix this issue I have changed by FTP the permissions on the file style-custom.css (The correct permissions is 777) locate in the root of the theme "wp-content/themes/bluediamond".
I have a folder, and for all php files in that folder (or even better, in that folder or any folders within it) I'd like to make some changes to the php settings. Can I just place a php.ini file in that folder with those settings I'd like to change?
If so, any reason why this wouldn't be working for me? It's my own server.
Thanks!
edit: I'd like to be able to use a local php.ini file, as I've been able to do with several webhosts. Is this a possibility?
It looks like you're wanting to use per-directory php.ini files which are available as of PHP 5.3. If it's your own server, I'd like to think you're happy to keep up with the latest stable releases (currently 5.3.2). Back to ini files, to quote that manual page:
Since PHP 5.3.0, PHP includes support for .htaccess-style INI files on a per-directory basis. These files are processed only by the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner extension. If you are using Apache, use .htaccess files for the same effect.
In addition to the main php.ini file, PHP scans for INI files in each directory, starting with the directory of the requested PHP file, and working its way up to the current document root (as set in $_SERVER['DOCUMENT_ROOT']). Only INI settings with the modes PHP_INI_PERDIR and PHP_INI_USER will be recognized in .user.ini-style INI files.
You'll have to use a .htaccess file for that. There a section in the PHP manual about that:
http://php.net/manual/en/configuration.changes.php
For more general information on htaccess files you can read:
http://en.wikipedia.org/wiki/Htaccess
or
http://httpd.apache.org/docs/2.0/howto/htaccess.html
The .htaccess files are typically the best way to go for an Apache server. However, to answer your original question, yes you can set a php.ini file in every directory if you want. However, in order for it to work, PHP must be set to run as PHP-CGI. My guess is that you are running PHP as an Apache module.
See this link for reference on where PHP looks for php.ini and when it looks for it: http://www.php.net/manual/en/configuration.file.php
You could also use ini_set(), if you wanted to do it in code.
instead of modifying php.ini file for each folder you would be required to modify a .htaccess file. Keep the file in the folders with whatever setting you like. You cant do this with a php.ini file since changes in php.ini are considered server wide
I uploaded a freshly downloaded copy of Wordpress 4.2.2 here: http://www.onedayonemillion.com/test/ and all I get is a blank page.
There are no .htaccess or wp-config.php files in the root directory.
No database has been connected yet.
I tried the same in another directory (/dev/) and it did the same.
I have no plugins installed or activated.
This is a fresh copy.
I added an phpinfo file here: http://www.onedayonemillion.com/test/info.php
Why can't I even get the install page to show up?
I didn't understand why there is no wp-config.php in the directory, it would be good you post what is in the directory. Anyway, you can check items like (sometimes it is just that):
some files with no ending "?>" ending the file;
any require_once methods calling non-existing files
(you said no, but) wp-config has wrong or non-set definitions (user, database)
check permissions/ownership to the folder
Well, I know it can be lame, but I had problem with definition in WPLANG define,
so I put an
echo "<br> there is no error until here";
through the files untill I find that was missing a comma at the definition. If the phrase is displayed, your installation files untill that point are working out.
Your phpinfo says the display_errors is off.
modify your php.ini with this line:
display_errors = on
you should restart the server after modification.
you can only track the error only if the error reporting is on in the server