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.
Related
I have migrated my site : http://www.mahodadhiinfra.com/ recently from windows hosting to linux hosting.
After it hosted and configured homepage running properly but unable to access any other page. i can only access page with a extension.
Ex.
http://www.mahodadhiinfra.com/wp-login.php (Working)
http://www.mahodadhiinfra.com/my-account/lost-password/ (Not working)
Initially I thought it might be a .htaccess issue but my .htaccess seems to be ok.
# 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
After that I tried with permalink change. But nothing worked. Hosting provider confirm that all settings are open what a wordpress required, e.g. AllowOverride ALL etc.
Can anyone please help me to get out of the issue?
Just 3 steps can help you:
Delete the .htaccess file
Login in /wp-admin/
Go to Permalink options and click "Save".
I've moved WordPress from hosts to Xampp local hosts.
I corrected the links inside the database. Although the home page is loaded.
But on every link, I'm redirected to the http: // localhost / dashboard page.
I use WordPress 4.9.6, Xampp 3.2.2 and Windows 8.1 64-bit
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
please guide me, thanks
For me, changing the .htaccess file as #Ustav suggested did not resolve the issue. After making that change, while I was no longer redirected to the XAMPP dashboard, I was instead redirected to a 404 page from Apache.
What did resolve the issue for me was simply navigating to Settings > Permalinks in the WP admin, scrolling to the bottom, and clicking "Save Changes", an idea I got from this WP forum page. That immediately fixed it, no changes to .htaccess required.
The remote-to-local transfer instructions I followed can be found on this 1&1 Ionos instruction doc
Try this:
Go to htaccess file.
Inside
<IfModule mod_rewrite.c>
...
</IfModule>
Put this code
RewriteRule . FOLDERNAME/index.php [L]
I have WordPress installed in the root folder and in a subfolder. I can access the home page for the WordPress site in the subdomain, but the permalinks does not work – error 404. I have tried to reset the permalinks, but it did not help. I can’t find any .htaccess file, so I have created one myself and placed it in the subfolder directory:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /projects/bigsargefitness/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /projects/bigsargefitness/index.php [L]
</IfModule>
Here is a link to the subfolder WordPress site:
http://ninahortendesigns.com/projects/bigsargefitness/
I have set the database options to the above direction.
Thanks for your help.
You will need to look at a few things:
.htaccess file in the root WP site (WP1) and edit it so that WP1 doesn't catch the URLs and generate 404 errors, I'm not sure if that comment assisted, I've used this answer for a similar issue.
.htaccess file in the sub WP site (WP2) and rename it to "htaccess.old" then log into your wp2/wp-admin, go to "Settings->Permalinks" check the URL structure is as desired (it doesn't usually change) and click "Save" at the bottom of the page. This will regenerate your .htaccess file within the context of the sub-directory and you shouldn't get 404 errors when you visit sub-pages like this
Here's the code from the first link edited so that it should work with your site, although if you have additional rules, you should only insert the line under the comment.
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
# Include in the next line all folders to exclude
RewriteCond %{REQUEST_URI} !(projects) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
If you have custom rules, only insert these lines
# Include in the next line all folders to exclude
RewriteCond %{REQUEST_URI} !(projects) [NC]
Assuming you're a designer and are uploading examples of sites you've built, you should only have to do step 2 the next time you upload a new site to the wp1/projects/ sub-directory
Cause
Error 404 occurs when the resource or path you requested cannot be reached. In this case it's likely because URL rewrite isn't working properly, hence the permalink requests were still being directed to the requested path (e.g. /projects/bigsargefitness/your-category/your-post-name) instead of the rewritten path (i.e. /projects/bigsargefitness/index.php).
The following solution assumes you use Debian/Ubuntu, otherwise the principles should remain the same.
Solution
Firstly, ensure that the rewrite engine has been installed:
sudo a2enmod rewrite
Then, ensure that the engine is allowed for the subdirectory by editing/adding the following lines in the file /etc/apache2/sites-available/your-site.conf:
<Directory /var/www/projects/bigsargefitness/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
The key here is to ensure that the line says AllowOverride All instead of AllowOverride None.
Finally, restart your server:
sudo service apache2 restart
Let me know if this helps.
I have problems with one of my Wordpress sites at my host.
Today I installed "Traffic Stats Widget" - plugin and I followed their instructions for installation. So , I did this:
Create a robots.php file on the root directory of your blog: ie public_html/your-blog/ Paste the following code without // in it:
# #
Open .htaccess file in the same directory and paste this in it:
RewriteRule robots.txt robots.php
Make sure you have the 'RewriteEngine On' clause in place...
Make sure you have a robots.txt file, even an empty one, on the root directory
After that I was unable to access all of my subpages.
This is link of my website:
http://idealpvc-dev.com/websites/camel/
And if you try to access some of subpages you will get error 404.
I don't know why, because I restored my .htaccess file but still it doesn't work.
Also I made comparison with others .htaccess file on other wordpress sites but there isn't any differences except folder names.
Any suggestion will be appreciated.
Also, above is content of my .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /websites/camel/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /websites/camel/index.php [L]
</IfModule>
# END WordPress
Sites is located at /public_html/websites/camel
Thanks in advance
Make this as a RewrieBase in your htaccess file
RewriteBase http://idealpvc-dev.com/websites/camel/
Instead of this
RewriteBase /websites/camel/
And make your wordpress permalink Default From Wordpress Admin panel > Settings >> Permalink >>> Default
I've been working on my localhost machine developing my wordpress site, and I'm going to export the database and import it to another localhost on another machine. The thing is, I've tried it already and when lets say you click on about it gives a 404 error not found in database. I'm using custom permalink structure /%postname%/
But when in the new localhost I change the custom to default it works. I don't want to /p?=123 at the end of my URL since I already have my links set up. Was wondering how I can set up the links to work?
you need to click on the wamp server, choose the apache menu -> apache modules then move the menu down and choose rewrite_module. You will need the server to restart for the changes to take affect.
If your .htaccess file is writable and mod_rewrite is enabled, WordPress will insert this code when you change the permalink structure. If it is not writable, WordPress will let you know to copy and past this code into the .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