admin管理员组文章数量:1130349
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.
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-
@fuxia I have checked wp-options and everything looks good there... when I install a fresh copy of wordpress...
mysite/wp-adminis accessible and all of its settings but as soon as I hitmysiteit redirects tomysite/NewSite– Aamir Shahzad Commented 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/NewSiteis 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
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.
本文标签: htaccessmaindomain of wordpress keep redirecting to subdomain
版权声明:本文标题:htaccess - main-domain of wordpress keep redirecting to subdomain 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749168307a2326565.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


mysite/wp-adminis accessible and all of its settings but as soon as I hitmysiteit redirects tomysite/NewSite– Aamir Shahzad Commented Nov 19, 2018 at 22:42example/NewSiteis 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