Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Unable to Change Permalink From Orginal Domain Name WordPress



I have a WP 3.0 Multisite instance working on a hosted server.

Backed up the instance and restored it to a local XAMPP 1.7.3.
Further Environment Specs are provided below.

Site is resolving locally, but with issues.


1. None of the Public Pages are displaying, just the core site template with
no top nav for the Public Pages. If I login as admin I can see Public Pages.

When I browse to http://localhost/agents/wp-admin it redirects to
an ugly URL:

Then when I attempt to login it sometimes redirects to the orginal URL on the hosted server (

I have to close the browser out and then re-browse to http://localhost/agents/wp-admin and login to get into the local site's Admin control panel.

2. I have attempted to change the PermaLink thru WP-Admin and it does not fix the situation. It continues to display the original site URL from the hosted server that I
backed it up from!

<strong>This is the process I followed to restore the MultiSite locally:</strong>

1. Copy all of the WP files into a new directory under htdocs

2. Search & Replace the site URL in the SQL file, replacing it
with http://localhost/site.

3. Change the site path definitions to localhost in wp-config:

define( 'DOMAIN_CURRENT_SITE', 'http://localhost' );
define( 'PATH_CURRENT_SITE', '/agents/' );

4. Import the SQL file into the newly created DB

5. Create the DB User with same DBUser and Pwd as in wp-config


7. Change the site URL's in wp_blogs and wp_option tables

=== Environment Spec ===

###### Apache Friends XAMPP (Basis Package) version 1.7.3 ######

+ Apache 2.2.14 (IPV6 enabled)
+ MySQL 5.1.41 (Community Server) with PBXT engine 1.0.09-rc
+ PHP 5.3.1 (PEAR, Mail_Mime, MDB2, Zend)
+ Perl 5.10.1 (Bundle::Apache2, Apache2::Request, Bundle::Apache::ASP, Bundle::Email, Bundle::DBD::mysql, DBD::SQlite, Randy Kobes PPM)
+ XAMPP Control Version 2.5.8 (ApacheFriends Edition)
+ XAMPP CLI Bundle 1.6
+ XAMPP Port Check 1.5
+ XAMPP Security 1.1
+ SQLite 2.8.17
+ SQLite 3.6.20
+ OpenSSL 0.9.8l
+ phpMyAdmin 3.2.4
+ ADOdb v5.10
+ FPDF v1.6
+ Zend Framework 1.9.6 Minimal Package (via PEAR)
+ Mercury Mail Transport System v4.72
+ msmtp 1.4.19 (a sendmail compatible SMTP client)
+ FileZilla FTP Server 0.9.33
+ Webalizer 2.21-02 (with GeoIP lite)
+ apc 3.1.3p1 for PHP
+ eAccelerator 0.9.6-rc1 for PHP
+ Ming 0.4.3 for PHP
+ PDF with pdflib lite v7.0.4p4 for PHP
+ rar 2.0.0-dev for PHP
+ Xdebug 2.0.6-dev for PHP
+ libapreq2 v2.12 (mod_apreq2) for Apache

Answers (5)


John Cotton answers:

Shouldn't this define( 'DOMAIN_CURRENT_SITE', 'http://localhost' ); be


Project Admin comments:

These define statements were already there from when we implemented the site (Remember this is WP 3.0 MultiSite, not Stand-Alone).

I only changed the variables from:

define( 'DOMAIN_CURRENT_SITE', '' )
define( 'PATH_CURRENT_SITE', '/agents/' );


define( 'DOMAIN_CURRENT_SITE', 'http://localhost' )
define( 'PATH_CURRENT_SITE', '/agents/' );

I took your suggested and commented out the original define statements and
tried both:






Error: Parse error: syntax error, unexpected T_STRING in wp-config.php online 76.

I have also made sure the WP_blogs Site URL and the WP_Options URL in the DB have been changed to "localhost" from the original domain URL.

John Cotton comments:

wp-login.php has a hidden field in it (redirect_to) the contents of which gets affected by various filters depending on exactly what the login form is doing (eg $redirect_to = apply_filters( 'lostpassword_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' );).

I've have a look at the source of the page next time you're logged out and see what value that's been set to. Then have a look through the code for something that's responding to whichever filter has been activated for that state.


Bob answers:

CLEAR your cookies!

If that does not work,

you can add this to your config @define('ADMIN_COOKIE_PATH', '/');

If that doesn't work try changing the path in the above for '/' to your directory.

Read this

ps.make sure you clear you browser cache and disable all plug-ins.

Project Admin comments:

@BOB - Tried everything you provided. We are closer after applying the Site URL Redirecting fix found on

So redirecting when trying to login to wp-admin is fixed.

My links in the theme are now referencing localhost as expected.

However, I have broken links when clicking on them!

"Browser can not display" errors, but not WP 404 errors.

I have validated in wp-admin that the links are referencing the permalinks to the Pages in the WP site, so don't understand why I am getting broken links when the link it referencing is appearing in the browser address bar as expected.

I have also confirmed in Settings > Permalink that it is now showing http://localhost as expected.

Project Admin comments:

I have disabled all plugins and issue remains with regards to broken links.


Kannan Sanjeevan answers:

Login to Admin account . Go to General Settings and change the word press url and site url to http://localhost/agents . This should fix the problem . Revert back if it doesn't fix the issue

Project Admin comments:

Another Interesting Issue

Cleared browser cookies/cache...closed out browser.

Restarted browser and browsed to http://localhost/agents...then added "wp-admin" and logged in locally to the admin control panel. Works as expected.

I then close browser out.

Re-open and browse to http://localhost/agents. I click on a sign-in link we have in the theme that references: http://localhosts/agents/wp-login.php...I then try to login as admin and it redirects to be to the hosted site on the domain URL.

Either way...the other links are still broken...even though they appear to reference as expected.

Kannan Sanjeevan comments:

Can u mail me the backup of the site to kan [ at ] cre8tivenerd [dot] com so that i can try it in my local host and come up with a solution .

Project Admin comments:

@Kannan - Yeah, sure.... let me zip that up with my credit card info and send it over.


mouad achemli answers:

get backup for your database

and open your database_backup.sql with any editor notepad+ or editplus

find and replace your ex domain with localhost

exemple : to http://localhost/

Project Admin comments:

@Moud - Yes I did that as part of my migration process and the site runs. I have even checked all of the DB tables looking for areas where the site or blog URL is still pointing to the domain URL and I can't find any.

mouad achemli comments:

first get backup of your database

and try to change link under general-setting to localhost/agent from your webhosting

and get your new backup and install localy


Peter Michael answers:

Login to wp admin. Go to Settings -> Permalinks and update your permalink structure. Also, what's in your .htaccess file?

Project Admin comments:

@Peter - I did this right after the migration process as this is typically a step that is neccessary to "true up" the Permalinks...but the Permalinks would not change. That is until I tried the fix for Site URL Redirecting fix found on

What is still baffling me is that now the Permalinka show the http://localhost, also when you hover all links displaying on the site they show reference to http://localhost. However, they are broken when you browse the links.

I can login to wp-admin with no issues and my permalinks are set to Custom Structure


Project Admin comments:

<strong>.htaccess Contents</strong>

# BEGIN WordPress
RewriteEngine On
RewriteBase /agents/
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# END WordPress

Peter Michael comments:

Do the links work when you disable pretty permalinks?

Project Admin comments:

@Peter - Oddly the links do work when I changed the Permalinks to Default.

All site links work, except the hard coded links like in the footer that still reference the http://localhost/agents/somepage.

Peter Michael comments:

OK, I suggest you to run your local copy on a virtual host and then try again, I've seen strange things when running WPMU on localhost. First, you need to edit your hosts file which is usually in 'windows\system32\drivers\etc\'. Add two entries like ' mydomain.lan' and ' www.mydomain.lan'. You may want to use your real domain and just change the .com to .lan

You then need to add your virtual host to 'httpd-vhosts.conf' in 'xampp\apache\conf\extra'. An example host:

<VirtualHost *:80>
RewriteEngine On
RewriteOptions Inherit

ServerName mydomain.lan
ServerAlias www.mydomain.lan
DocumentRoot "path/to/www"

ErrorLog logs/mydomain.lan.error.log

<Directory "path/to/www">
AllowOverride All
Order Allow,Deny
Allow From All

After you have set up your host, again replace all occurrences of the domain name to the new local domain name. The re-import the SQL file to your DB again (delete all tables first) and update your permalink structure after login to your wp-admin.


Project Admin comments:

1. Changed hosts file to use original domain URL: localhost domainurl.lan www.domainurl.lan

2. Changed httpd-vhosts.conf as recommended

3. Changed the URL reference in the backup SQL
from to http://domainurl.lan/agents

Site does not come up now

I think I am done chasing this....until I have more time to test how best
to migrate WPMU from localhost to hosted host and back again...I am sticking with single site instances.