Upload an image in wordpress on a local server - wordpress

I am making my first steps coding and I have wordpress installed on my computer on a local XAMPP server. I try to add an image directly in a page from the wp admin but it's not possible and it shows me this error :
Unable to create directory wp-content/uploads/2016/03. Is its parent directory writable by the server?
Do you know why it happens? I create manually the directory wp-content/uploads/2016/03 and its still happening.

Create folder with name "uploads" in wp-content folder and set this folder permission 777
Hope it will work
Thanks

Try to manually update/change the uploads directory instead of defaults:
Log into your WordPress admin dashboard.
Go to Media Settings menu (Settings -> Media).
Enter wp-content/uploads in the “Store uploads in this folder” text
box.
Save the changes by hitting the “Save Changes” button and you are
done.
Note: if you don't have this option in your wordpress version, you need to edit the wp-config.php file located in the root directory of your WordPress installation.
define( 'UPLOADS', 'wp-content/'.'uploads' );
also you can change the name of uploads folder as you want.
UPDATE 1:
Try adding the following to the top of your .htaccess file (before # BEGIN WordPress line):
<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>

Related

Hide WP-includes, and WP-content/uploads from WordPress

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>

How to redirect wordpress (installed inner directory) to main root address?

I've installed wordpress into a inner directory. like root/mysite . Why I didn't install it on root because there are so many addon domain installed, and I literally don't want to mess all addon domain folders with wordpress files inside root directory. My root directory is for www.example.com . And my wordpress site I've installed on root/mysite, so the url for that is www.example.com/mysites . Is there anyway to redirect www.example.com/mysites to www.example.com . As I said the only reason for not installing wordpress on my root, because I don't want to mess wordpress files, folders with other addon domain's folders on root.
So my main goal is showing a wordpress site on www.jimfahad.com that is installed on www.example.com/mysites. Is there any way?
Yes, you can leave the WordPress install and folders in mysites, but you have to copy the .htaccessfile and the index.php file to root. This will result in the visual URL of WordPress being in root (example.com), but the uploads, theme URLs, etc, being in example.com/mysites.
See the WordPress Codex > Giving WordPress Its Own Directory « Using a pre-existing subdirectory install on how to copy and edit the files:
1) Go to the General settings panel.
2) In the box for Site address (URL): change the address to the root
directory's URL. Example: http://example.com
3) Click Save Changes. (Do not worry about the error message and do
not try to see your blog at this point! You will probably get a
message about file not found.)
4) Copy (NOT MOVE!) the index.php and .htaccess files from the
WordPress (wordpress in our example) directory into the root directory
of your site—the latter is probably named something like www or
public_html. The .htaccess file is invisible, so you may have to set
your FTP client to show hidden files. If you are not using pretty
permalinks, then you may not have a .htaccess file. If you are running
WordPress on a Windows (IIS) server and are using pretty permalinks,
you'll have a web.config rather than a .htaccess file in your
WordPress directory.
5) Edit your root directory's index.php:
6) Open your root directory's index.php file in a text editor. Change
the line that says:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
to the following, using your directory name for the WordPress core
files:
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
and save the file.
7) Login to your site (if you aren't still already). The URL should
still be http://example.com/wordpress/wp-admin/
8) If you have set up Permalinks, go to the Permalinks panel and
update your Permalink structure. WordPress will automatically update
your .htaccess file if it has the appropriate file permissions. If
WordPress can't write to your .htaccess file, it will display the new
rewrite rules to you, which you should manually copy into your
.htaccess file (in the same directory as the main index.php file.)

Migrate wordpress site from subfolder to root, remove static page

My website have structure like this:
In root domain I have static html page "portfolio" (which I won't need it anymore, becauose I'll create it in wordpress):
http://www.natasamedvesek.com/
and I have installed wordpress for blog in subdirectory:
"natasamedvesek.com/blog/"
Now I have also all my pages structured like this "/blog/about" , "/blog/info" .... .
Now I'm asking what to do:
(1) move wordpress instalation from subdirectory "blog" to root directory.
or
(1) leave wordpress instalation as it is, in subdirectory "blog" and create redirect 301
My new structure would look like this:
"natasamedvesek.com" ---> portfolio "natasamedvesek.com/about" ---->
page "about" "natasamedvesek.com/info" ----> page "info" . . .
"natasamedvesek.com/blog/" ---> page of postsIt's very important that I won't lost all my existing likes and shares from facebook, from all of my posts? What about my existing rank for SEO on google?
If I do create redirect 301, what I have to do?
Is this correct way, if I would put this code in .htaccess file
#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.natasamedvesek.COM/$1 [R=301,L]
Thanks for answers
It's much easier than using redirects; you can use the pre-existing subdirectory install and have admin at /blog/ while root appears to be at root.
From Giving WordPress Its Own Directory « Using a pre-existing subdirectory install
1) Go to the General panel.
2) In the box for Site address (URL): change the address to the root directory's URL http://www.natasamedvesek.com
3) Click Save Changes. (Do not worry about the error message and do not try to see your site at this point).
4) Copy (NOT MOVE!) the index.php and .htaccess files from the blog directory into the root directory of your site.
5) Edit your root directory's index.php. Open your root directory's index.php file in a text editor. Change the line that says:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
to the following, using your directory name for the WordPress core files:
require( dirname( __FILE__ ) . '/blog/wp-blog-header.php' );
and save the file.
6) Login to your site (if you aren't still already). The admin URL should still be http://www.natasamedvesek.com/blog/wp-admin/
7) If you have set up Permalinks, go to the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can't write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)
very important that I won't lost all my existing likes and shares from
facebook...
You will lose your Facebook shares because the URL is changing, and there is no way to change an incoming Facebook link. And your SEO will take a temporary hit because you are changing URLs, at least until Google reindexes the site.

magento under wordpress as subdirectory not working

I am using godaddy server.
I have wordpress as root directory and i have setup magento from local to server inside root as subdirectory.
Magento home page is working fine,but when i try to open any supage of magento then it opens "About us" page without CSS of root wordpress.
Thanks in advance.
Have you set the RewriteBase statement in Magento .htaccess ?
#RewriteBase /magento/
become
RewriteBase /subdirectory/
If your server is configured correctly you don't need to set RewriteBase, but make sure your base url is set correctly in backend as {server-root}/subdirectory/. If you cannot access admin, you'll need to change data in core_config_data by searching fields by url and setting the correct value by for example phpMyAdmin. Otherwise you'll need to do it by ssh + mysql command... or reinstall your Magento instance giving correct url to the installer.

Unable to upload new theme to wordpress from dashboard

I installed wp to a server for the first time. The basic theme works and I can change the settings but I bought a new wordpress theme and was trying to upload it from the dashboard:
But it gives me an error each time:
These were suggestions I found online but didn't work:
So I tried to change the permissions of all of the folders to 755. And then I changed the permissions of the file update.php to 755 also but I still get the same error. I also tried editing the .htaccess of the folder 'AALimo' (folder which contains the wp dir) but that didn't work either. I'm not sure if I edited the .htaccess properly.
I just manually uploaded the theme into the theme directory using ftp instead of the theme uploader from dashboard and that worked.
I did it using C-Panel. I had to upload zip file in WordPress theme folder in public html. extract the zip file and you can install it easily .

Resources