page 404 wordpress not triggering - wordpress

I have installed 404 plugins, I even have a 404 page but I don't know why it is not showing.
My website is one page website and when it should display the 404 page it shows :
Not Found
The requested URL /asd was not found on this server.
Apache/2.2.15 (CentOS) Server at mysite.com Port 80
What can I do to solve this?

you need to add handler for error page in .htaccess file
for example in htaccess file add this code:
ErrorDocument 404 /your404page.php

First check that you have a .htaccess file in your WordPress root folder (the one that contains your wp-config.php file). If it's missing, copy the following text (source) into a new plain-text file called .htaccess in the WordPress root folder. Also, make sure this file is readable by Apache (permissions of 0644 should suffice).
# 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 that doesn't help, then your Apache server doesn't support the use of RewriteRule directives. This is most likely because mod_rewrite isn't enabled for your particular domain. To fix this, you need to edit the Apache configuration file and add this line to the configuration statements that apply to your domain:
Options +FollowSymLinks
The location of the Apache configuration files can vary depending on your hosting setup, but try looking for a file called httpd.conf in /etc/httpd/conf/.
Check your server's error log too. There might be some useful information in there.

Related

Creating exception for specific subdirectory in .htaccess

This should be a simple problem to solve, but I'm struggling to find a solution that works.
I have recently deployed a Flask application, which is working fine except for an issue with my .htaccess file. The application is deployed in a subdirectory (which is supposed to be reachable at mysite.com/flaskapp) alongside a wordpress blog (mysite.com) that works fine with the 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
I have found that if I delete the content of the .htaccess file, the flask application works well, but none of the wordpress links beyond the front page work. Conversely, with the content above intact the wordpress install works, but every URL in mysite.com/flaskapp/* gives a 'post not found' message from the WordPress site.
As a result I assume the setup I need is to somehow not have the above rewrite rules active for any url beginning with mysite.com/flaskapp, but feel free to correct me if this assumption is wrong.
What do I need to do the the .htaccess file to resolve this so that both the wordpress blog and the Flask application work?
UPDATE: There is also a .htaccess file in the flask application's directory, in case that changes or explains anything:
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN
PassengerAppRoot "/home/user/flaskapp"
PassengerBaseURI "/flaskapp"
PassengerPython "/home/user/virtualenv/ratings/3.6/bin/python3.6"
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END
Try adding a line like:
RewriteCond %{REQUEST_URI} !^/directory
after the other RewriteCond lines, replacing "directory" with "flaskapp" or the name of the directory to exclude.
The flask application's htaccess shouldn't need any altering.

Wordpress page not found on AWS

I have transferred a wordpress website on AWS (EC2 and RDS-Mysql servers). The DNS has been setup in Route53.
The wordpress files has been located under directory:
/var/www/html
And the mysql database is imported on RDS. The home page looks fine but when I click on the other pages, it gives "404 not found" error. I have modified /etc/httpd/conf/httpd.conf file to allow WordPress to use permalinks:
<Directory "/var/www/html">
AllowOverride All
I have also checked the size of transferred files and they look as same as the main files.
Any help would be appreciated.
I could solve my problem by adding .htaccess file in the directory of my wordpress files.
# 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
http://guiem.info/permalinks-on-wordpress-amazon-ec2/
Try to follow these steps:
In the WordPress dashboard go to Settings > Permalinks
Without changing anything click on the Save button
And then try to click on the inner pages, it should load fine.
Why does this happen? When you change server, the paths and urls are changed. When you save permalink settings then WordPress will update its rewrite rules and so it will work fine.

.htaccess rewrite issue only loading homepage

I have moved a site from my test dev to a live server (its wordpress) and for some reason no matter what page I click on only the homepage loads.
Think I have narrowed it down to 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
and this line in particular:
RewriteRule . /index.php [L]
If I remove this or remove the htaccess completly I get a Forbidden 403 error.
I was hoping someone could help me figure this out?!
Very common issue is redirect plugin. Disable all plugins and post back. Have you got your website in the root folder or is it in the sub directory?
Update:
Changing the Site URL
There are four easy methods to change the Site URL manually. Any of these methods will work and perform much the same function.
Edit wp-config.php
It is possible to set the site URL manually in the wp-config.php file.
Add these two lines to your wp-config.php, where "example.com" is the correct location of your site.
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
This is not necessarily the best fix, it's just hardcoding the values into the site itself. You won't be able to edit them on the General settings page anymore when using this method.
Source
Update:
Goto
wp-config.php
and add
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
Turned out there were a bunch of random files in the root, with the FTP I only had access to the public_html. There were a number of htaccess files and other config files which we cleared out and it solved the problem.

Why do none of the pages in my Wordpress site work?

I am trying to move a Wordpress site to a new server. The domain name is also changing from "olddomain.com" to "newdomain.com."
To this end, I moved all the files over to the new server and set up a virtual host in Apache. I then used a script (http://interconnectit.com/124/search-and-replace-for-wordpress-databases/) to replace instances of "olddomain.com" with "newdomain.com."
The home page of my site is working when I visit it in a browser. However, none of my other pages such as "newdomain.com/about/" are working - they return 404s.
I checked my Apache error log and got the following log.
[client 69.184.72.91] File does not exist: /home/david/wordpressSiteFiles/about, referer: http://newdomain.com/
Why is Apache looking for a file called "about" on my server? Here is the .htaccess file I have now.
# 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>
Do you have allowoverride set on the server?
http://codex.wordpress.org/Using_Permalinks
allowoverride must be set in your httpd.config or your .htaccess will
be completely ignored.
Your server may not have the AllowOverride directive enabled. If the
AllowOverride directive is set to None in your Apache httpd.config
file, then .htaccess files are completely ignored. In this case, the
server will not even attempt to read .htaccess files in the
filesystem.
Source
http://wordpress.org/support/topic/wordpress-cant-find-my-new-pages
I had this same problem a few days ago and this fixed it!
Sounds like you have rewrite rules that need to be updated. Look for a .htaccess file.

index.php script will not run at webroot

I have recently migrated a WordPress blog over to a new ubuntu server running apache2. The
path of the blog is physically at /var/www/approot/public/home/blog/(wp-stuff here) which is the same path as the old server.
NOTE this is NOT a WordPress issue. I can execute a simple PHP script that I've created in this folder; phpinfo.php which returns just fine. However, the index.php returns a 403 forbidden message.
Weirdly, I can log into the WordPress console just fine if I access it directly at http://www.example.com/home/blog/wp-login.php and then http://www.example.com/home/blog/wp-admin/index.php.
But I cannot reach http://www.example.com/home/blog/index.php -- I get 403.
Also, I can access the categories pages, and any links under the ../home/blog/wp-content folders, but just not the main page.
I do have an .htaccess file which looks standard:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /home/blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /home/blog/index.php [L]
</IfModule>
# END WordPress
Also, permissions are set the same on all .php files in the ../home/blog/ folder
-rwxr-xr-x
Does anyone have any ideas of why the index.php is forbidden?
Sounds like the same issue I had.
Did you see a list of directories and and files instead of normal WordPress pages at http://www.example.com/home/blog/ and http://www.example.com/home/blog/wp-admin?
If yes, you'd need the following:
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
(or something similar)
in either your httpd.conf (will apply to all virtual hosts) and each virtual host (if you're using virtual host)

Resources