I was in process of deploying my wordpress website mysite/NewSite
to mysite
during the deployment I messed up something and my main site has started redirecting from mysite
to mysite/NewSite
.
I have deleted everything from root folder, checked cpanel redirects section etc but everything looks fine. I also created .htaccess
file under public_html folder but still no luck.
# 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 know this more kind of a descriptive question. This is kind of super urgent as site is down which an issue. You help is required.
I was in process of deploying my wordpress website mysite/NewSite
to mysite
during the deployment I messed up something and my main site has started redirecting from mysite
to mysite/NewSite
.
I have deleted everything from root folder, checked cpanel redirects section etc but everything looks fine. I also created .htaccess
file under public_html folder but still no luck.
# 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 know this more kind of a descriptive question. This is kind of super urgent as site is down which an issue. You help is required.
Share Improve this question edited Nov 19, 2018 at 22:28 fuxia♦ 107k39 gold badges255 silver badges461 bronze badges asked Nov 19, 2018 at 22:26 Aamir ShahzadAamir Shahzad 1232 silver badges7 bronze badges 2 |2 Answers
Reset to default 1According to the Codex instructions:
https://codex.wordpress/Changing_The_Site_URL
If you add these defines to your wp-config.php
define( 'WP_HOME', 'http://example' );
define( 'WP_SITEURL', 'http://example' );
These will override the options saved in your wp_options
table, you should then remove the /NewSite suffix from your General Settings page. (Or if wp-admin is accessible now you may be able to just do that already.)
Alternatively you could edit the database directly and change the home
and siteurl
values in wp_options
and that will achieve the same thing.
I've never liked changing the domain name within the wp-settings.php file. I always change it directly in the wp-options table (in two places)...since that is where it will be defined (and read from in Settings). My theory is why not change it in the original spot (the wp-options table) rather than adjusting the values in the wp-settings file.
So, my first thing would be to remove those values from wp-config.php, then make sure the proper URL is in the wp-options table. And then to use a standard htaccess file according to the codex. Make sure you supply the full URL, with the protocol (as in https://www.example ).
Changing the permanlinks value will sometimes rewrite the htaccess file, but I always just use the standard htaccess from the Codex.
mysite/wp-admin
is accessible and all of its settings but as soon as I hitmysite
it redirects tomysite/NewSite
– Aamir Shahzad Commented Nov 19, 2018 at 22:42example/NewSite
is a subdirectory, not a subdomain? What response do you get fromexample/NewSite
? Have you confirmed this is an external 3xx redirect? What status code are you seeing: 301, 302, 3xx? Or do you get a 200 response (which indicates a client-side redirect)? – MrWhite Commented Nov 20, 2018 at 9:01