'Wordpress change base url for wp-admin

My word press installation resides in public_html/cushbu folder

and it will be accessed by www.example.com/cushbu so i have changed the base url's in wp-config.php

define('WP_HOME','http://www.example.com/cushbu/');
define('WP_SITEURL','http://www.example.com/cushbu/');

Also i've edited this line .htaccess file

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domain.com/cushbu/ [NC]

the problem is i can't access the wp-admin its redirected to old url

So how can i completely change the base url??



Solution 1:[1]

Change the url in your database table called wp_options field's home url and site url. Change it to your new url.

Solution 2:[2]

outside of cushbu folder, in public_html folder, you should have .htaccess file modify that file with the following line.

# Redirect Trailing Slashes...
RewriteEngine On
RewriteBase /
RewriteCond $1 !^(cushbu)

and WordPress source has .htaccess file edit like this

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cushbu/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cushbu/index.php [L]
</IfModule>

Solution 3:[3]

You need to change the site URL and home URL in the database too. Its in the wp_options table. I hope you have database access.

Cheers!

Solution 4:[4]

Follow simple steps to replace in core database url

1) You need to export your old database to local computer

2) Notepad++ editor or some other editor tool. replace (cntrl+H) in notepad++

3) First Find http://www.example.com/cushbu/ and Replace with new URL eg. http://www.newexample.com/cushbu/

4) Second Find without http www.example.com/cushbu/ and Replace with new URL eg. www.newexample.com/cushbu/

5) Final find any old url is present or not.if yes than replace by new url and save.

6) Import new replaced database to old database and login by wp-admin and click on Settings / Permalinks now it's done.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bhavik Shah
Solution 2 Hardika Satasiya
Solution 3 Ranuka Bathgalawalavwe
Solution 4 Tejas Soni