Wordpress - permission denied - php

I have a website and I'm passing it to another server. I using permalink day and name. When I try to access to any page I receive this message:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
If I change the permalink to plain it works but I need to set it in day and name
I don't know what kind of problem is that.
How can I solve that?

Take a look at chmod in wordpress files/dirs
https://codex.wordpress.org/Changing_File_Permissions
OTher thing may me htaccess.
https://codex.wordpress.org/htaccess

As My Experience with WordPress I Advice First Set Permalink again default one ... and check is everything working ? Also try in build other permalink options is that working?
If above both working then write your custom permalink ..
If above booth not working then Check Rewrite option of domain it must Allow .htaccess to fix just replace .htaccess file https://codex.wordpress.org/htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
This simple tip will fix your issue ... DONT FORGET TO CLEAR CACHES
Cheers

Related

I accidentally deleted my .htaccess file how to get it back?

I started using wordpress with my website (through 000webhost) and then I realized that's not really what I want. Not at all. So I went through and deleted all the files. There was a .htaccess file (for Wordpress) and one called .htaccess_origional. I accidentally deleted the original one and now I'm stuck with a Wordpress one that won't work. It was a file with no restrictions or modifications. I remember that it only had one line. Does anybody know how to get it back? Thanks in advance!
You just have to visit Settings > Permalink and save. It will re-generate the .htaccess file.
If you want to create the initial .htaccess file configuration. Here is the initial .htaccess configuraiton
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Reference: https://www.hostinger.com/tutorials/create-default-wordpress-htaccess-file
It's been a while since I last used their service but if I recall correctly you can rebuild your webdir (or whatever it's called).
You'll have to search for this function in your control panel.
When you click this it will reset your server so BE SURE TO HAVE A BACKUP.

There is "/?i=2" in my wordpress website index url

I recently grabbed a host and first there was an index2.html in my htdocs root which was default index, I didn't remove that until I install wordpress in that root. then wordpress automatically made a httaccess file with following codes which is normal:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
now I realize that sometimes there is /?i=1 or /?i=2 in my general url, for example, wordpresssite.com/?i=2
this is a problem because I'm using some ad-unit system and I gave my website url to the system but it seems that the ad system bots some time redirect to "wordpresswebsite.com/?i=2" url and it does not match with the url I entered before (wordpresswebsite.com) so it's not gonna work.
now I removed the index2.html but the problem is still there.
this ?i=1 or 2 is about PHP GET parameter but how this parameter will appear.
I found this on reddit with similar issue and the conclusion was:
Most likely there are some rules at vhost level.
---- yes it's from the host, they said they cannot disable it as it's protecting me from bots.
For those interested in removing the /?i=1 installed mostly by free host providers here's a tip.
Edit & upload the .htaccess file in root of website
RewriteCond %{QUERY_STRING} ^(.*)\?i=1$ [NC]
RewriteRule ^(.*)$ /$1?%1 [R=301, L]
If you're using Apache, you have to enable mod_rewrite first.
sudo a2enmod mod_rewrite
Then restart or reload your server for the new configuration to take place:
sudo service apache2 restart
(Try to find some fancy control panel option for this, if not having shell access)
?i=1 or 2 or 3 is to protect your website from bots. Try using cloudflare for your website or use the .htaccess code to remove ? paramaters. Note that using any code to remove ?i=1 will remove all ? parameters.

Wordpress after migration doesn't work

I had problems with WordPress migration from one server to another, and generally now it works but I have many smaller problems..
Before I use domain oldexample.com and now i use domain newexample.com/something . Generally everything on the page works but changing language isn't work (qTranslate plugin).
I think that I found the reason of this - in admin menu I found in some places situation that href links start from "/" for example: "/wp-admin/..." and in result it change the URL from newexample.com/something/wp-admin to newexample.com/wp-admin. I see this problem in qTranslate settings links and when I want delete some plugins. I get the error message "404 Not Found - nginx/1.4.5" in results...
Did you see this problem before? Maybe I should change something in WordPress core files? .htaccess? Now it looks like this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?newexample\.com\/something$ [NC]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
After long time I find the solution! All "href" are generated by using $_SERVER['REQUEST_URI'], and this variable show only the rest part of the path (without /something/. I add to wp-settings.php this part of code: $_SERVER['REQUEST_URI'] = '/something'.$_SERVER['REQUEST_URI']; (on the very beggining) all forms generate good path.

PHP file in WordPress Directory

I have created a folder within WordPress public_html folder and created a test.php file in it as below.
www.mysite.com/myfolder/test.php
When I navigate to this url, I get page not found 404 error. All other files in myfolder, e.g. test.txt load without any issues. It's just php files that are not running. Could anyone please help?
My .htaccess file is
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
WordPress has its own .htaccess that is probably treating your URI as some sort of "Search Engine Friendly" thing, and translating it into some other format that WP is expecting. For example, http://www.mysite.com/myfolder/test.php might get rewritten to something like http://www.mysite.com/myfolder/index.php?target=test%25php. That would give a 404 error from within WP (not a real server 404 error). Perhaps something can be done from within WP's configuration, or you could modify the .htaccess to tell it specifically not to rewrite test.php.
This is weird since WP leaves your files alone due to RewriteCond %{REQUEST_FILENAME} !-f condition.
Try creating a myfolder/.htaccess file with this line:
# just one line here
RewriteEngine On
This will basically nullify all rewrite rules of parent folder.
Please check file-folder permission of myfolder. It should not be 777 instead it should be 755 on your server.
Please refer Wordpress php file execution

Using $_POST data after wordpress url rewrite

My permalink structure is set so I have url.com/page
I made a basic PHP script prior to installing wordpress that uses $_POST data to display the correct set of information, so the base would look like url.com/work.php?featured=print
After adding this to my Wordpress installation with the rewrite from the permalink structure above, the link actually works as:
url.com/work/?featured=print
I'm having trouble getting the extra rewrite to work so that a clean url.com/work/print will work properly.
This is what my .htaccess file looks like, I appended the last line before the end IfModule tag hoping that would take anything work/[page]/ and direct it to work/?featured=[page]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
RewriteRule ^work/([^/.]+)/?$ work/?featured=$1 [L]
</IfModule>
# END WordPress
any help?
EDIT
Discovered rewrite via the functions page and found this quite resourceful
Rewrite rules for WordPress
however, my rule is taking .com/work/print (work/?feat=print) and simply showing it as .com/work without the page data being passed through
'work/([^/]+)/?$' => 'work&feat=$matches[1]'
The above is the only thing I changed from post I just referenced. I tried keeping is specific to get it to work first to avoid any loose ends...
Still not working properly though
The wp-admin dashboard has a tool that helps with the rewrites. When I ran a few WP sites, I used it to achieve what I wanted. Did you try that first?
http://www.rlmseo.com/blog/passing-get-query-string-parameters-in-wordpress-url/
For some reason, couldn't get anything to work, but ^ is quite simple and worked great

Categories