I have hosted a WordPress site in AWS EC2 and migrated my local to AWS. Now the home page is working fine, but other pages are not opening. It is returning 404. Tried the following in .htaccess-
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
then in apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Still no luck. I tried changing the permalink structure, but it is not saving. I keep clicking on the Save Changes button, nothing.
There was a conflict with one of the plugin installed. So, I disabled all the plugins and it was working. Then, one by one I started activating and parallelly checking the functionality and finally found the culprit plugin.
Related
I have local server, on which I'm running WordPress with Composer.
After database migration from my local to AWS RDS, the permalinks changed it's behaviour: now there's 'index.php' in the beginning of tags, like:
http://example.com/index.php/name-of-page
Also, in the wp-admin->Settings->Permalinks the structure is custom now:
/index.php/%year%/%monthnum%/%day%/%postname%/
Details about my local server:
Xubuntu 18
Apache2
AllowOverride All for both / and var/www/
it's on Composer, with custom dir (wp-content is seperated from wp core)
.htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /project/public/wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /project/public/wp/index.php [L]
</IfModule>
# END WordPress
What I have tried:
http://dejanjanosevic.info/remove-index-php-permalink-in-wordpress/
http://derekmolloy.ie/remove-index-php-from-your-wordpress-url/
updating permalinks
updating composer
selling my soul to Satan
What are the results?
Modyfying .htaccess has no effect - just ends in 404, the only links that work are still the ones that include /index.php/. Updating permalinks from WordPress has same result.
I'm running out of ideas here.
I've got it.
For anyone looking for a solution to the same problem, here's guide:
Change permalink settings in wp-admin to pretty permalinks
Install mod_rewrite module in apache
The most important part, in etc/apache/apache2.conf (NOTE THAT YOU MUST CHANGE THE NAME OF FOLDER):
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>
<Directory "/var/www/html/NAME_OF_YOUR_PROJECT_FOLDER">
Options FollowSymLinks
AllowOverride All
</Directory>*
Restart apache
I can't seem to figure this out. I'm using Apache 2.4.7 on Ubuntu 14.04 and I have mod_headers enabled. In my /etc/apache2/apache2.conf file, I have the following default Directory statements:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
I'm trying to override the default apache2.conf config by using VirtualHosts for my actual website directory in /etc/apache2/sites-available/000-default.conf:
<VirtualHost *:80>
ServerAdmin blahblah#123456.so
ServerName 999.999.999.999
DocumentRoot /var/www/html/domains/website1
<Directory /var/www/html/domains/website1>
Options -Indexes +FollowSymLinks
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
The website works just fine but whenever I try to enable SEO friendly URLs, I get a 404 error stating the page does not exist. Here's the .htaccess file located in /var/www/html/domains/website1/ (It's a standard Wordpress .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
Any ideas would be greatly appreciated. Thanks!
Silly me. I figured it out as I was filling out the Tags section of the form and the tag mod-rewrite popped up as one of the suggestions. I needed mod_rewrite enabled! Durp. Well, thanks to the stackoverflow web developers for building that feature into the site :)
I have a wordpress site located on
/var/www/html/site
so I wanted to setup a Virtual host for Apache 2.4
<VirtualHost *:80>
DocumentRoot "/var/www/html/site"
ServerName www.site.com
<Directory "/var/www/html/site">
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
But while most of the resources do load, a lot of fonts and scripts are giving a Error 404 Not Found. Why is this?
Also what can I do? Are they restricting some but not others?
EDIT: Here's Some errors we're getting.
GET http://52.16.22.15/site/wp-content/plugins/djd-site-post/css/display.css?ver=4.0.1
52.16.22.15/:41
GET http://52.16.22.15/site/wp-content/plugins/codecanyon-5299073-bugmebar-a-simple-little-notification-plugin/bugme.css?ver=1.0.4
52.16.22.15/:46
As most of the site works, only some get requests are failing to get resources. I noticed it's mostly scripts and stylesheets.
This is what I have in my directory .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /site/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]
</IfModule>
# END WordPress
# BEGIN wtwp_cache
# END wtwp_cache
# BEGIN wtwp_security
# END wtwp_security
There's more but it's on the level one above. But I am also reading that VirtualHost directories do not inherit .htaccess from parent directories. IS this true?
Try adding AllowOverride All
Like this,
<Directory "/var/www/html/site">
Order allow,deny
AllowOverride All
Allow from all
Require all granted
</Directory>
I'm trying to configure WordPress permalinks on Linode server running Ubuntu. The permalinks are not working even after doing the basic tricks for configuring them.
.htaccess -file has been given permission "777" and WP has rewritten it:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mydirectory/mysubdirectory/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /mydirectory/mysubdirectory/index.php [L]
</IfModule>
# END WordPress
I have configured "etc/apache2/sites-available/default in a following way:
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride ALL
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride ALL
Order allow,deny
allow from all
</Directory>
<Directory /var/www/mydomin.com/public_html/mydirectory/>
RewriteEngine On
AllowOverride ALL
</Directory>
As you can see I've tried to set "AllowOverride" to different folders. I just gave it a shot, thought that maybe something is overriding the rule for certain folders.
I have ran "a2enmod rewrite" command on Terminal and mod_rewrite is enabled.
I have restarted my Apache every time I've made changes.
When I navigating on my WordPress site I get "Page not found" error. Apache error log says following:
File does not exist: /var/www/mydomain.com/public_html/mydirectory/mysubdirectory/
What am I missing here?
The below settings can go in your VirtualHost directive for the site in question. In most cases this is located in a separate file and referenced from the main conf file for the server.
RewriteEngine On
AllowOverride ALL
Generally speaking you want to keep all of the settings for each site in their own file. So if you need to tweak anything else do it in the file containing the VirtualHost directive for that site. It makes it much easier to troubleshoot/maintain in the future.
My WordPress installation is in a different folder from my main site:
/var/www/html/wordpress <= WP installation
/var/www/html/main-site <= main site
I would like to have WP display when someone visits /blog from my main site:
http://www.main-site.com/blog (Note: main-site is used as a generic placeholder for the real site because it is not launched yet)
I have set up an alias in my httpd conf file:
Alias /blog /var/www/html/wordpress
<Directory /var/www/html/main-site>
DirectoryIndex index.php
Options -MultiViews
AllowOverride All
order allow,deny
allow from all
</Directory>
I have the following as my .htaccess file for WP:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
I get a 404 when I visit http://www.main-site.com/blog but when I visit http://www.main-site.com/wp-admin/index.php, it works (but I get a 404 if I visit /admin). Visiting the sample blog post and sample page also works for me.
http://www.main-site.com/blog/hello-world/
http://www.main-site.com/blog/sample-page/
It looks like rewrite is working but my /blog index page doesn't work.
Any suggestions would be greatly appreciated.
Thanks,
Allen
Finally figured this one out! It turns out that Passenger was enabled and I had to disable it.
Alias /blog /var/www/html/wordpress
<Directory /var/www/html/main-site>
PassengerEnabled off
DirectoryIndex index.php
Options -MultiViews
AllowOverride All
order allow,deny
allow from all
</Directory>