I was trying to add SSL to a WP site that lives in a subdomain using this tutorial: https://www.youtube.com/watch?v=GPcznB74GPs .
All was working well and the site was responding to HTTPS until I edited the .htaccess file to try to force all traffic to SSL. Now I get "The requested URL / was not found on this server." on all domains (there are other sub domains that are siblings of the one I was editing and they are broken too).
After editing the .htaccess file and seeing the site was broken, I put the .htaccess file back the way it was but now it's still broken. I edited 2 files trying to fix this (public_html/.htaccess and public_html/mysubdomain.com/.htaccess) but have reverted each back to their original contents. Still no love.
The public_html/.htaccess is 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
#begin brad changes
php_value max_input_vars 3000
#end brad changes
and the public_html/mysubdomain.com/.htaccess file is this
# Switch rewrite engine off in case this was installed under HostPay.
RewriteEngine Off
SetEnv DEFAULT_PHP_VERSION 53
# 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
They are so plain vanilla I don't understand what could be going wrong.
Note that sibling sites (public_html/myOtherSite.com/) are also broken but i've not changed anything in those folders. This leads me to believe the main .htaccess file is messed up somehow.
I edited the files using GoDaddy's CPanel editor which asked me before opening the files if UTF8 was OK. Should that matter?
It turns out this was user error. Apparently CPanel support drag/drop and I inadvertently dragged my public_html folder under public_ftp so all my files were "gone". When I put the public_html back, everything started working again.
Related
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.
Okay, I've got a working wp installation (www.SITEURL1.co.uk) at the root of SERVER1 and I want to move another wordpress (www.SITEURL2.co.uk) I have in another server (SERVER2), in a subfolder of (www.SITEURL1.co.uk/onlinerevision) right now like this:
ROOT(siteurl1)
wp-admin
wp-content etc.
(SITEURL1/onlinerevision/)
wp-admin
wp-content etc..
So I put the 2nd wp installation files into the given (www.SITEURL1.co.uk/onlinerevision/) subfolder. Now I can see the homepage is accessible, the css is not okay and also all the links are redirecting to the www.SITEURL2.co.uk
e.g: www.SITEURL1.co.uk/onlinerevision/login/ is redirected to www.SITEURL1.co.uk/login/ or
www.SITEURL1.co.uk/onlinerevision/signup/ is redirected to www.SITEURL1.co.uk/signup/
Also www.SITEURL1.co.uk/onlinerevision/wp-login.php is looping in a redirect to the same page (www.SITEURL1.co.uk/onlinerevision/wp-login.php) and I can't login to dashboard like this:
http://siteurl1.co.uk/onlinerevision/wp-login.php?redirect_to=http%3A%2F%2Fsiteurl1.co.uk%2Fonlinerevision%2Fwp-admin%2F&reauth=1
In the database I opened for www.SITEURL1.co.uk/onlinerevision/, I'm changing the wp_options table -> siteurl from www.SITEURL2.co.uk/ to www.SITEURL1.co.uk/onlinerevision/
but somehow it's turning back to www.SITEURL2.co.uk/
Apparently www.SITEURL1.co.uk and www.SITEURL1.co.uk/onlinerevision/ both have the same htaccess codes:
# 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 tried different methods but didn't work. Any help would be really appreciated!
Thanks for your time.
Sorry got side tracked again.
First, lets address the .htaccess files.
In the root you want to tell it to ignore your second WordPress installation directory.
/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# Skip your second WordPress installation
RewriteCond %{REQUEST_URI} !^/(onlinerevision|onlinerevision/.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
For the second installation you want to set the RewriteBase then tweak the final rule so it uses it properly.
onlinerevision/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
# Set the RewriteBase to this directory
RewriteBase /onlinerevision/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Remove the slash before index.php or we end up at root
RewriteRule . index.php [L]
</IfModule>
# END WordPress
Second, there are two places you need to change the site URL when you move a WordPress installation. They are both located in the wp_options table. One is named siteurl and the other is named home.
I yanked a copy of one of my test sites and moved it to a directory in another test site then set those two .htaccess files and was golden. Most other oddities in a move are related to plugins/themes or URLs embedded in pages/posts. If you still have issues try disabling all themes/plugins to see if it clears up.
Debugging mod_rewrite
Also, you can turn on logging for mod_rewrite to help narrow it down. The log can be cryptic but once you figure out how to read it you can usually pick out what is going wrong or at least narrow it down. To do that you need to add a couple lines to the server conf (not htaccess file). A good place is the VirtualHost directive for the site you are having trouble with...
RewriteEngine On
RewriteLog "/var/log/httpd/rewrite.log"
# From 0 (no logging) to 9 (OMFG make it stop)
RewriteLogLevel 3
PS: Logging over 2-3 has a significant impact on your server so only use it when debugging and don't forget to turn it off when done.
This is a WordPress site.
Originally the person who built the site had set it up so that the site gets pulled up by going to domain.com. So all requests for www.domain.com gets punted to domain.com.
This is the standard code inside my .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
How can I change my .htaccess file so that this forward does NOT happen and folks can get to the site using BOTH domain.com as well as www.domain.com...??
Looks like WordPress itself determines which version will show up. The WordPress Address field in Settings is what sets the tone. There is no easy way to make both non-www and www work. Can be done via .htaccess I suppose but definitely not worth the effort.
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.
I have a WordPress website im trying to call a php script that is located on the website the URL is something like this
http://example.com/folder/process.php
The problem is when I try to do this i always get redirected to the themes "not found" page.
This is the 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
If i put a test.html file in that directory it will work, and show the contents of the .html file. I think it has something to do with the .php extension it doesn't like?
If i call example.com/wp-config.php it finds that file and deosnt show a 404 page..
This Rule says "If request starts with index.php, do not rewrite and stop".
RewriteRule ^index\.php$ - [L]
Immediately before or after that line you could add something like
RewriteRule ^process\.php$ - [L]
To not rewrite requests to that particular file.
Note that you will have to put your file next to Wordpress' index.php for this to work properly.
Change your .htaccess to this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/+folder/process\.php$ [NC]
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Try turning off mod_rewrite altogether in your /folder/ directory by creating an htaccess file in there and simply adding this single line:
RewriteEngine On
It will make it so any rules from the parent directory won't be applied. If the weirdness with PHP continues, you may want to check if there aren't any rules in your vhost/server config or that things like Multiviews are turned off (via Options -Multiviews).
Ok so if I took a default file that came with the WordPress install made a copy of it in the cpanel rename it remove the code and than put my code in it.
The file is found and it works. So im thinking the only thing left it could have been was a permissions problem. The permissions i put for the file when i uploaded it was 777. I know NOTHING about file permissions.
And i have been working on this for 5 hours and im done trying to figure out what the problem was it works..and im good with that.