404 error while moving wordpress site from local to live? - wordpress

I am trying to move my WordPress site from local to live. In my case homepage is working fine, but while migrating to next page or other menus it shows 404 error. I have changed my .hdaccess file and permalink settings. But it is not working. can anyone give a clear solution to this problem?
My existing .hdaccess file is
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /bookExperts/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /bookExperts/index.php [L]
</IfModule>
# END WordPress
I have changed my .hdaccess as given 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

You need to go to table wp_options and change site_url and home with your new domain name.
after this go to sql tab in phpmyadmin and run below code
UPDATE wp_posts SET post_content = REPLACE(post_content, '{old_domain}', '{new_domain}');
this will fix broken links & images.

Follow these steps.
settings > permanent links > save changes
it's all
Before migrating you must have changed the url:
settings > WordPress address (URL) / Site address (URL)

Related

Wordpress 404 error on every page except homepage (After migration)

I have migrated my wordpress website from my desktop over to siteground for hosting. Prior to doing this I had been using free hosting at x10. The first time I transferred the site everything worked fine. The second time I tried (new version of the website) I found that every page except the home page had a 404 error (this was with x10). I then got hosting at siteground and am still having the exact same problem. Any solutions to this?
My .htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /testsite/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /testsite/index.php [L]
</IfModule>
# END WordPress
To fix it
Login to /wp-admin
Go to settings-> Permalinks
and click on save changes button.
when migrate a wordpress site, you should change the wp_options table siteurl and home url,
then login to admin back end -> settings -> permalinks - set the permalinks and save,
Then you can set the .htaccess just set following code and test.
`#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>`

Page not found in wordpress localhost

I have installed Wordpress on my localhost, no links are working. I get page not found.
What can I do ?
Using .htaccess like:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /akclinics/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /akclinics/ [L]
</IfModule>
# END WordPress
If you not able to go /wp-admin just open your database then
Your database-> wp-options table->wp-options->site-url->check and change it.
After Follow this steps once:
This may be caused by the permalink or .htaccess
Go to settings-> permalink-> set it as default ->Reload or refresh
Then again now Go to settings-> permalink->postname
Your .htaccess will get update with the permalink.

Wordpress migration and htaccess file

I need to migrate a wordpress from http://myoldwebsite.com/blog to http://newwebsite.com/.
I have htaccess file as follows. Am I right if I change
RewriteBase /blog/ to RewriteBase /
RewriteRule . /blog/index.php to RewriteRule . /index.php
My .htaccess code.
# BEGIN WordPress
<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>
# END WordPress
Just use a migration plugin, like WP Migrate, to export the DB.
After you are done with the DB import, don't forget to go to Settings->Permalinks and just hit save button, in order to have .htaccess updated.
Done.
Unfortunately it's not as simple as just changing the .htaccess file.
From the Wordpress codex:
When your domain name or URLs change - i.e. from
http://example.com/site to http://example.com, or http://example.com
to http://example.net - there are additional concerns. The files and
database can be moved, however references to the old domain name or
location will remain in the database, and that can cause issues with
links or theme display.
The most important change which most trips up a lot of people is to change "siteurl" and "home" in the "wp_options" table to point to your new address.
Yes you can add the following to htaccess file. If you are migrate a wordpress from http://myoldwebsite.com/blog to http://myoldwebsite.com/
# 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
Note You have to change URL in database also.
If you want to migrate a wordpress from http://myoldwebsite.com/blog to http://newwebsite.com/. You can use followin plugin to migrate
Plugin link

Some WordPress permalink problems, probably depending by wrong .htaccess configuration?

I have import on my local webserver a backup of a website made using WordPress but I am finding some difficulties with PermaLink configuration
The main problem is that if I use the permalink setted as Article Name I can see the homepage but if I click on the articles links into the homepage (to see the article) I always obtain the following message error:
Not Found
The requested URL
/wordpress35/2012/10/11/se-milano-avesse-il-mare-anzi-no-la-montagna-di-campiglio/
was not found on this server.
If I instead I use the Default settings for permalink (http://localhost/wordpress35/?p=123) I have no problem and I can access to the articles in my website
I think that this is a .htaccess problem. Can you help me to create an .htaccess file that solve this problem?
My actual .htaccess file is:
# 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 need to use the URL format described as: http://localhost/wordpress35/my-article-name
Did you try creating a the wordpress .htaccess for your needs?
# 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
This should work if you didn't specify any change in the website's URL.
(If the homepage is still http://localhost/wordpress35/ )

Wordpress - pages stopped working - permalink issues?

I developed a simple wordpress site for a company.
Today they called me and said that some of the pages can't be visited.
So i checked it out , and seems like 3 menu options for apparent reason just stopped working. They said they haven't done any changes.
http://oi40.tinypic.com/ofqcev.jpg
Check the permalink it says says "projektledning" like it should be , and wordpress refuses to find the page.
http://oi40.tinypic.com/16h9mcg.jpg
And i tried for no reason to change the permalink and i've added "-1" to the link and bam its working...
What should i do to make the permalink work as the regular name it should be?
Try toggle permalink once under admin - settings - permalinks. Make sure you're server has write access to your .htaccess file before doing this.
.htaccess should look 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
At the last row, make sure there's a space between . and /
Also check your permalinks for any typos (spaces).
IF your url is foo.bar/something, make your .htaccess look like:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /something/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /something/index.php [L]
</IfModule>
# END WordPress
Hope this helps!

Resources