Redirect to outside Wordpress - php

I have a folder called "stats" on my server that I cannot access anymore because wordpress redirects it to the "Page not found". This folder has nothing to do with wordpress. I have searched for a solution but nothing seems to be working. I am using the theme elegant fusion.
For clarification, the folder is on the same level directory wise as "wp-admin", "wp-content", "wp-includes".
Does anyone know how I can access my folder without going through wordpress?
Thank you in advance!

Enable searach engine optimised permalinks is the answer. I am thinking you must be using the default permalinks, by enabling seo permalinks in Settings->Permalinks in the backend will create (assuming permissions allow, if not you do it manually) an .htaccess file in the root of your install like so;
# 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 that will solve your problem are;
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Which tell wordpress to ignore any url which is for an actual directory or file. Anything else gets rewritten by Wordpress.

Related

Running POST request to php script which sends contact mail from within wordpress subfolder results in 404 Not found

I've just read so much about this issue, but I'm lost here. Can't make this s*$%& work. Here's the issue. Graphic designer has a working WordPress, of which I know same as nothing, about some kindergarten in the city. She builds a landing page to throw a marketing campaign within a subfolder landing201812 inside the public_html folder of the hosting space. The WordPress is installed/deployed/whatever at the root of the site.
Site: https://www.newmills.com.ar/
Landing: https://www.newmills.com.ar/landing201812/
Directories:
public_html/
- lots_of_wordpress_rubbish
- .htaccess
- landing201812/
- sendform.php
Reading about wordpress bootstrapping way for processing all the requests, I have altered the .htaccess file in public_html so it excludes the rewriting of wordpress and goes straight to the landing site.
Original 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
Actual content
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^landing201812/?.* - [L] # My added rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
With both configurations, the static content (html/css/media) is served correctly, but, any php I would like to execute within that landing201812 folder, fails with a 404 Not Found error. I have tried also to exclude any landing201812 route with RewriteCond directives from the last RewriteRule like
RewriteCond %{REQUEST_URI} !.*landing201812.*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
But the results are the same.
I am quite limited to move around the wordpress since I know nothing about wordpress. I have considered moving it to a subfolder of the public_html, but I'm afraid of breaking it, or its URLs. I have tried to disable the permalinks, but there's no On/Off switch that I could find.
Last, but in case you may wonder, I have tried including another .htaccess file inside my landing201812 folder. RewriteEngine Off did not work as much as the alternative I took from a native wordpress subfolder:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /landing201812/
RewriteRule ^.*\.php$ - [L]
</IfModule>
# END WordPress
So... does anyone know what's wrong, or even better, how to fix this issue? Everyone says on the web that I should be fine with the htaccess rule, or disabling the permalinks, or moving the wordpress to a subfolder and not the root folder. Moving it is the last thing I would like to do, because I won't know how to fix it if it breaks. Am I missing something? Is there any log I should check?
Thanks in advance for any help.
if you are using cpanel, this is not necessary to do in .htaccess
Instead, can you please keep the original wordpress .htaccess and just assign permissions with filezilla to 775 to the folder?
Also, there should be a configuration missmatch, please try re-loading the PHP version in CPANEL (with PHP MANAGER) only to that folder.
If you can provide access to the site in private, maybe I can give you a hand.
It seems to me that if you were to keep the origional WordPress .htaccess and change your file structure to the following it will work at /landing201812/:
public_html/
- lots_of_wordpress_rubbish (not my opinion, just here to match OP)
- .htaccess
- landing201812/
- index.php
The key is naming the file index.php. Otherwise, you can call the file by name like so: /landing201812/sendform.php.

wordpress redirecting all pages to homepage

I have a wordpress website www.spiderhost.asia, when i click on any link on the website it's redirecting to the homepage which I don't want, it was working perfectly few days back and I didn't change any config and anything in website , still it's not working properly.
I contacted server admin, wordpress admin regarding same but didn't find any solution for that.
Even I didn't make anychanges to 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
I need help resolving this
That htaccess file is saying that if the file or directory being queried does not exist and it is not index.php, then reroute to index.php. Make sure that the file you're trying to query exists (and that it's in the correct directory).

wordpress 404 error when trying to acess folder on root

I have a wordpress website and within the root directory a folder called /ideal/.
The function for the /ideal/ folder is to make payments trough the website from visitors.
Everything worked well for a while, since a few days there is a problem with the page.
When i navigate to my website http://www.nibincasso.nl/ideal/ it wil show up with a 404 error.
With the release of wordpress 4.0 it looks like wordpress is trying to make some sort of dynamic link for the folder /ideal/.
However i want it to open as a static page, not by making it a wordpress dynamic page. “http://www.nibincasso.nl/ideal/index.php”.
Example of .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
Can someone help me with a solution for this problem?
Kind regards,
Fabi
Update *
I created a new subdirectory on my root with a blank index.php page only saying test
This one opens fine. But when i try to enter the subdirectory /ideal/ with the index.php i get a 404 error. How come?
Try following
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ideal/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ideal/index.php [L]
</IfModule>
# END WordPress
There seems to be a problem with the php code inside the index from the /ideal/ folder.
I will search for the solution this is not a wordpress problem.
Thanks for helping me for so far.

Error 403 Forbidden if I go to a wordpress url that is the same of an existing directory

I am developing a new site in wordpress, my site is completed and I want to replace it with my old site (not a wordpress site, a php and html site).
The moving wordpress procedure is correct (I have installed wordpress in a subdirectory), i can see everything but when i go to a page like www.site.com/mypage which is the same name of an existing folder in my site (www.site.com/mypage) i get the 403 error.
in the folder there is not a index.php/html file.
I want to keep this permalink structure and the folders name..
I do not want to show the list of files in the directory, but only the page I have created in wordpress.
how can I fix it?
thank you
htaccess here:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
Just ran into this problem and found an answer here: http://jeffreybarke.net/2011/01/wordpress-permalinks-403-forbidden-error/
In short, you need to write a few lines into your .htaccess which specify the folder names with the problem:
# Fix 403 errors on existing directories; WordPress overrides.
RewriteCond %{REQUEST_URI} ^/(folder1|folder2|etc)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]

Wordpress perm links

Whenever I set the permanent links on wordpress to something other than the default
p=123
The links go to 404 pages
For example:
http://thewebsite.com/i/blog/2012/05/sample-post/
Would be linked as the blog post, but it would take you to a 404 result.
What can cause this kind of issue?
You need to have a rewrite in place.
In the root of your website, create a .htaccess file. This will be a hidden file but if you are using Filezilla as a FTP program you will be able to view it.
Put in it this:
# 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
Save it in the root of your website, ie, where wp-config goes and it should work.
If you have your website in a sub directory you will need to change the Rewrite base to reflect this instead of / for root.
Hope this helps!

Categories