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)
Related
I'm working with a website built on WordPress, it's a fairly standard setup in cPanel. I've developed new features for the website in Laravel. I now need to view the Laravel public directory to an accessible web address.
I've tried symlinking the public Laravel directory to a directory inside public_html (where WordPress is).
I'm getting a WP 404 error, rather than the symlinked folder (Laravel public).
/home/user/public_html/ (WordPress DIR)
/home/user/repositories/laravel-app/public (Laravel public)
I then ran:
ln -s /home/user/repositories/laravel-app/public/ /home/user/public_html/book-online
I was hopeful that when going to domain.com/book-online it would load the Laravel app but it doesn't appear to be the case.
Update
I've managed to move a little further, I've realised the directory is definitely being resolved, I can access assets, just not index.php. For example. I can go to URL:
domain.com/book-online/css/style.css
and it will load the Laravel stylesheet
domain.com/book-online/index.php
gives me WordPress 404.
This is my .htaccess in public Laravel folder.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [L]
</IfModule>
It looks like you're missing the /repositories folder in the symlink path "ln -s /home/user/laravel-app/public/"
Also make sure your DNS entry is set up to look for the url you need : domain.com/book-online in your cpanel
Setting proper permissions fixed the issue.
I needed to set permissions on the public folder to 755 and also the index.php file to 644.
For others who may land here with a similar problem: First, you must symlink the public folder (or rename the public folder and move it to a publically accessible location) and set the permissions as above.
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.
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.
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.
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.