0

I was in process of deploying my wordpress website mysite.com/NewSite to mysite.com during the deployment I messed up something and my main site has started redirecting from mysite.com to mysite.com/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.

2
  • @fuxia I have checked wp-options and everything looks good there... when I install a fresh copy of wordpress... mysite.com/wp-admin is accessible and all of its settings but as soon as I hit mysite.com it redirects to mysite.com/NewSite Nov 19, 2018 at 22:42
  • What is the significance of "NewSite"? Is it the actual directory where WP is installed? Was it only used in development? Was it only used on the development server? You use "subdomain" in the title, however, example.com/NewSite is a subdirectory, not a subdomain? What response do you get from example.com/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
    Nov 20, 2018 at 9:01

2 Answers 2

1

According to the Codex instructions:

https://codex.wordpress.org/Changing_The_Site_URL

If you add these defines to your wp-config.php

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

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.

2
  • Updated but still the same issue :(:( Nov 19, 2018 at 23:22
  • hmmm not sure, that should do it, try going to Permalinks page and clicking save, also logout and login again, could be browser caching now also, Google clearing cached redirects for your browser, and/or force refresh the page...
    – majick
    Nov 20, 2018 at 0:58
0

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.com ).

Changing the permanlinks value will sometimes rewrite the htaccess file, but I always just use the standard htaccess from the Codex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.