I have some php scripts in my Wordpress directory and I'm unable to use them. Why? Because Wordpress treat them as posts.
For example:
http://kaptinlin.com/themes/striking/wp-content/themes/striking/includes/sendmail.php
Points to a file and it works.
But on my site when i try to open /wp-content/themes/myTheme/anyDictionary/anyfile.php
it loads:
Not Found
Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.
Page.
How to fix that?
Thanks
The default WordPress mod_rewrite rules look something like this:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
In essence, this says "pass all requests through WordPress, unless the request corresponds to a real file or directory." So, if you're seeing a WordPress delivered page when you expect the output of a non-WordPress script:
Your rewrite rules differ from the default; paste them for help debugging. Or,
The file may not exist where you think it does.
Related
I’ve changed my custom permalink setting to /%pagename%/ (which is common, I guess). However, the following problem keeps occurring:
When trying to open a post on my website, I receive a 404 error. When changing the permalink setting back to Standard, the errors disappear.
After googling, I found that there is a way to solve this by editing your .htaccess file. Even after this, the same problem reoccurs. As I would like to have clean page-names, would anyone know how to solve this problem?
Greetings,
Tom
Kindly delete your .htaccess file from the root folder and check your site again, if the problem is still there than regenerate the permalinks using %postname%.
For the url rewriting WP feature to work, WP writes the .htaccess file at the root of your WP installation.
Open the .htaccess file and check whether or not you have this piece of code:
# 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
If it is missing, you have 2 options:
change the file permissions so that WP can write it.
or add the missing code yourself to the .htaccess.
I am using wordpress on godaddy windows hosting. using 4,7,4 version of wordpress.
For some reason permalinks do not work in any mode except of plain, selecting any other structure results in 404 errors at all pages except of home. I know there is a ton of similar questions, but none of the existing solutions does not help (at least all solutions I could find).
.htaccess file is changing when permalink structure is modified, it adds a code that looks as it supposed to be:
# 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
Giving different permissions doesn’t do anything.
According to the hosting provider the web server meets all requirements
The website is using woocommerce. Disabling all plugins was tried as well – no effect.
Any other ideas how can I fix this or at least where the problem is? Thanks in advance
You may need to enable mod_rewrite to accept the server to access the formatted URL's
Edit , httpd.conf
AllowOverride all
Also inside php.ini remove ; from the below extension,
extension=php_curl.dll
I have a Wordpress site that I assumed from another company which structurally is a bit different than other ones I've worked on. I'm primarily a Drupal developer, with enough of a working knowledge of Wordpress to get by.
What the developer who created the site did, is within the themes folder, they created a separate page-whatever-whatever.php file for each page on the site. Some of the content on the pages within the site have been entered through the CMS system - some are hard coded on to the template file.
Previously, it was hosted on a .NET server - we're on LAMP.
It appears that the pages with the hard coded data aren't being called - so the data the client previously saw is just coming up blank. The site appears to be ignoring those page-whatever-whatever.php files and using the default template page instead.
My first guess is that it's an htaccess issue? I just have the generic
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Given the structure they have - is there something else I should be putting in there or changing within the config files?
Thanks in advance!
I guess no issue with .htaccess file. The error was in template file. Enable debug in wp-config.php.
By wp_debug was false.
define('WP_DEBUG', false);
Change this to
define('WP_DEBUG', true);
Now you can see php error in the template file then debug it.
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.
I agreed to host a file for an online community, but I've since changed my site around so that it's now hosting a wordpress blog. What I'd like is to not break the existing URL to this one file, so, for example, when people navigate to the URL where file is being hosted, e.g. myblog.com/path/to/file, I'd like Apache to handle the URL rather than Wordpress, so that the file on the filesystem is delivered, rather than a Wordpress "We could not find the post" page. I think that the way to do this is to modify .htaccess so that that specific URL myblog.com/path/to/file does not execute index.php. Right now, here's what my .htaccess file looks like:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Could anyone tell me how to modify .htaccess to unmanage the URL to one file, but execute index.php for all other URLs?
Any guidance would be appreciated. Thanks.
These rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
will tell mod_rewrite to skip any file or directory which actually exist. As long as you don't move this special file of yours, then mod_rewrite won't redirect the rewrite to the main index.php.
Now, if you're moving the file elsewhere, but want to preserve the old url, then you'll have to do as toscho said in his answer do a Redirect.
Redirect permanent /old/path/to/file /new/path/to/file
# BEGIN WordPress ...