what have you done since Wordpress v3.0, all direct PHP files are not working in WP, all are returning 404 page not found, I have created one plugin, it's loading /wp-content/plugins/myplugin/direct.php file and what am I seeing now, it shows me my WP site with title PAGE NOT FOUND 404, help me please I can't work with WP any more, all direct PHP files are not accessible and tracked as 404.
What should I do to turn off that terrible 404 or get my php files loaded.
Check your .htaccess file, maybe all URLs now are mapped to the index.php file of Wordpress.
Based on the provided rewrite rules, I would suggest to use this instead:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*shop/images/(\d+)/?\??(.*)$ /wp-content/plugins/shopp/core/image.php?siid=$1&$2 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I'm not understanding the question. You're saying that you've created a plugin, and it's not calling in the files properly? (I'm assuming by "direct PHP file access" you mean you can't load a particular file that's within your plugin directory?)
Sounds like you're not using the correct paths. You should be using things like WP_PLUGIN_URL constants that are set up for you via WordPress (http://codex.wordpress.org/Determining_Plugin_and_Content_Directories) - i.e it doesn't sound like an .htaccess issue, it sounds like improper coding in the plugin.
Of course, without knowing what code you are using, it's difficult to say what the issue could be.
Related
I'm uploading my website to Apache on CentOS on Google Cloud and I can't access all of my existing web pages, I get the following error:
Not Found
The requested URL /home was not found on this server.
However, when I create a new page I can access it no problem.
I've uploaded my files again, and double checked all the database stuff checked out and I've checked my .htaccess file. I can't figure out what's going on.
Make sure that the .htaccess file contains the following content:
# 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
You should also check if .htaccess is actually working. The easiest way to check this is to intentionally break it, by adding some text to the file. If .htaccess is working you should get an Internal Server Error page.
I have a simple wordpress website and it seems to be hacked. I used some plugins to scan it and they say my htaccess file is infected. Now I could use some help clean it up - specifically, to understand
What to look for to clean up? I.e. what does an "infection" in htaccess look like?
how can I prevent unauthorized access to the file in the future?
The htaccess in question is:
http://pastebin.com/TcWiQvNP
Here's default wordpress 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
also for permission
set chmd to 644
First, you need basic understanding of mod_rewrite configuration structure to understand what your current file does and be able to edit it correctly.
Now, the broadly defined redirects to some absolute URLs do look suspicious. But I don't know if the URLs correspond to your site or some other.
In general, you need to identify which directives are "alien" - i.e. do not correspond to the apps you're running at the server.
This is either blindingly simple or impossible; after lots of Googling and thread reading, I can't tell.
I have a WordPress site that uses a plugin to create a custom post type. The rub of this is that the custom post type has a very ugly "slug". What this means is that the URLs look like this:
http://mysite.org/uglyname/a-post-title/
Where "uglyname" is an ugly name. I can't change the name without editing the core files of the plugin, which is a bad idea in this context.
What I'd like to do is make it so that if a user visits a URL like this:
http://mysite.org/prettyname/a-post-title/
Wordpress interprets prettyname as it would uglyname and is more or less nonethewiser.
I don't want something that just redirects; I'd like it to be a silent mapping. But keep in mind that Wordpress is already using the .htaccess file to map everything it gets onto http://mysite.org/index.php.
Is this possible, or am I just barking up the wrong tree?
EDIT to add: The current .htaccess is the WordPress default:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mysite.org/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /mysite.org/index.php [L]
</IfModule>
# END WordPress
Just above RewriteCond
%{REQUEST_FILENAME} !-f, try the following line:
RewriteRule ^prettyname/(.+)/? /uglyname/$1
If I'm not mistaken, it should pass it over, and then still process the index.php routing.
Haven't tested it - not at a server right now.
Hello guys what can be the reason for this:
I have a folder "wallpapers" not related to my website (Wordpress) in the same web hosting and images inside. If i wanted to access them I would go to website.com/wallpapers/myimage.jpg and it worked!
But I noticed it doesn't work anymore now I see my wordpress site + error 404 inside the website.
I have tried to fix this disabled few plugins etc... but where should I look? What can be the reason? Maybe the htaccess?
Thanks!
Yes, I think your guess on the .htaccess is perfectly correct. If you enable permalinks in Wordpress it automatically creates, or tries to create (depending on permissions) the following .htaccess file;
# 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
The two lines in this that are relevant to you are;
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
What they are basically doing is making sure that every url request gets run through the index.php in the root except any files or directories that actually exist as separate files and directories outwith the Wordpress install (ie your wallpapers directory). So first of all I would make sure that your .htaccess looks like this.
I needed to do the same in the past, and it drove me nuts so if that can help here's what I've done. I had the default .htaccess wordpress created in my wordpress folder when activating the permalinks option, the folloowing :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
for some reason...
I could access http://example.com/phpinfo.php fine,
but http://example.com/myfolder was returning a 404, despite (if I'm correct) the line RewriteCond %{REQUEST_FILENAME} !-d should allow me to show what was into that folder as it's existing and having the correct permissions (user:user chmoded 755)
after having tried everything I could find on the subject, I ended up creating a .htaccess into my folder "/myfolder"
with the unique following line in it :
Options +Indexes
And I finally got http://example.com/myfolder to answer the response 200 OK
I suppose this is not the best ever solution but it's the only one that worked for me and as I just need this to work for one or two folders, it did not need to be more adaptive / flexible
I am having a CRAZY error with Wordpress. When I create a new article or edit an old one, I cannot insert hotfile links that go after the first trailing slash.
I'm explaining it better. If in a post I do:
TEST
I can correctly create the article. If I do:
TEST
Or longer link, like:
TEST
I get an instant 403 error when updating the post from administration. This is crazy, and happens only with Hotfile links. Everything else works like a charm.
What could the error be? If it helps, i'm posting my .htaccess, that I never changed from my WP installation:
# 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
Already done repairing and optimization of MySQL DB. Kind thanks in advance to everyone.
I'm a regular WP developer, and I see little bugs like this all the time. Unfortunately, it usually means it's time to go through the tedious work of testing. The problem likely lies either with Apache/htaccess, or in a WP plugin or Theme.
To attempt to eliminate WP as the cause of this specific issue, I'd try creating a php file with the following in it:
<?
if (isset($_POST["field"]))
echo $_POST["field"];
?>
<form method='post'>
<input type='hidden' name='field' value='TEST'>
<input type='submit' value='Test'>
</form>
If clicking "Test" does not result in the same 403 error, then it's something happening with WP specifically. If it does result in a 403, then it's a much more annoying problem that you are going to want to take up with your hosting provider.
If it is a WP problem, the first thing I would do is to start deactivating plugins 1 by 1, starting with the plugins I think are the most likely culprits. If I have no reason to suspect one over another, I just disabled them all, 1 at a time. Once a plugin is disabled, I try to recreate the original issue. If the problem still happens, it's obvious that plugin wasn't at fault, and I reactivate it and test the next one. 9 times out of 10, my issue is found this way. Be careful when trying this, as some plugins will clear their settings when they're deactivated.
If that doesn't solve the issue, I'll try a different theme and see if that fixes it. Obviously if the problem is gone when you try a new theme, you know where your problem is. Again, some themes can have setting associated with them, and changing the theme can lose those settings.
Finally, check your wp-content/mu-plugins folder for plugins that are always active and don't always show up in your list of plugins.
I realize this post is as ancient as time itself but I've run into a similar problem took me forever to figure out what was going on until i realized all I had to do is add:
Options +FollowSymLinks
At the top of the .htaccess file and presto! It worked.
Options +FollowSymLinks
# 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
Credit goes to this good man: http://www.coolestguyplanettech.com/403-forbidden-error-wordpress-htaccess/
I also had a similar issue, apparently wordpress has some problems with some bits of code I tried to add in my post. I managed to bypass the issue by surrounding the code in <pre> tags.
Mostly, 403 forbidden error is because of four reasons 1. File permission. 2. Issue with plugins. 3. Hotlink protection 4. issue with .htaccess file 5. Your CDN(Content Delivery Network). For solving this error you need to check all these aspects to remove the error.
check the file permission as you know
the file has permission for 644 and the directory 755
Deactivate the plugins. Sometimes you might get errors because of plugins
next you need to delete .htaccess file and create a new file with the below code
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Next you need to check hotlink protection for your site. As it proved your website to link media or files from other sites.
lastly, you need to check for CDN you can disable it to know if it causing error or not.
I know my answer is late in coming but just wanted to add my 2 cents.
I would recommend checking the .htaccess file to make sure it is similar to below.
# 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
You could try adding Options +FollowSymLinks as adamj stated in his answer so the .htaccess would look similar to below.
Options +FollowSymLinks
# 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
Check to ensure that no plugin are causing the issue. Disable all plugins to see if the issue persist. If it doesnt, it would be a process of elimination to figure out which one is the cause.
Finally, I have removed the .htaccess file and that also worked for me but no .htaccess file would means no URL rewrite unless your web server is otherwise configured.
I hope this helps someone.