Moved Wordpress to a subdirectory, don't want site-url to redirect to my subdirectory - wordpress

I've searched a while but couldn't find an answer to this question yet. I had WP originally installed in the site root and moved it to a subfolder and went through the common steps necessary. I do this because I want to run wordpress only for blogging reasons and keep another HTML site as my main project that I want to access through my domain www.example.com and the wordpress blog through www.example.com/blog/
I moved the WP system therefore to /blog and changed the site address and wp address to that folder and followed the usual steps. Everything works just fine. Still when I enter my domain it redirects automatically to the /blog subdirectory and not to the site that lies in the root that has a index.html. There is no .htaccess file in the root or anything similar. How is that possible? Happy about all suggestions.

Related

create a htaccess rewrite rule from subdomain to subfolder

There was some discussion on this topic which i have read through, but it does not help my current situation.
Problem.
I have a wordpress mu site located on a subdomain (site.website.com)
The first subsite i created is (site.website.com/subsite1)
I want to serve (site.website.com/subsite1) from (website.com/subsite1)
I know this is possible because i already do it in a different way. I have a wp mu located in a subdolder.(site.website.com/mainsite) and have created subsites at (site.website.com/subsite1) (site.website.com/subsite2) (site.website.com/subsite3)
I did this by manaually editing the site url in wordpress admin, then creating a folder in the home directory, with the same name as the subsite and placing a htaccess file with rewrite rules in it.
Now i want to achieve the same thing with a multisite install in a subdomain, pointing to a folder in the apex domain with a htaccess file in it.
The problem is that im lacking in knowlege when it comes to rewrite rules. Any experts please step up.

Wordpress redirecting to wrong homepage

I worked for a few days on XAMPP with a wordpress platform. After I bought a domain, I decided to use Duplicator plugin to transfer my whole wordpress snap to the new server. Everything is working just fine except for one single thing: whenever I go to my website, instead of visiting the actual page that should be "www.example.com/welcome" it redirects automatically to "www.example.com/wordpress". I made some research about it and discovered that usually wp is installed in a wordpress directory, but I completely made sure that:
on htaccess there is no /wordpress directory url
on index.php there is no /wordpress directory url
on wp-config there is no /wordpress directory both on SITE-URL and HOME
made sure that on the wp-admin config panel in the General section, the URLs are both set to the root directory.
For some unexplicable reason, everything is working fine, www.example.com/shop works for example, but if I set from the customization panel a page like "www.example.com/dummy" as homepage, then THAT page won't be found because it automatically redirects "dummy" to "/wordpress" which of course does not exist. You can type www.example.com and be redirected to www.example.com/wordpress and the same thing happens if you type www.example.com/dummy, since now that should be the homepage.
Can anyone explain me why is this happening? I searched everywhere but I can't find an answer.
I'm using the Storefront theme and Woocommerce plugin if that might help.

.htaccess reditrect subdirectory page to root

I got a website running and in the subdirectory domain.com/blog/ I installed a Wordpress blog website. The subdirectory contains dozen of blog articles, for example
domain .com/blog/testing
domain .com/blog/example
domain .com/blog/article1
domain .com/blog/article2
And what I am trying to do is to rewrite and redirect (a single page) domain.com/blog/example to domain.com/example
Any way to do this?
It seems javascript redirect is better than htaccess redirect for your case.
Simply edit your article using a code editor in wordpress.
<script>window.location = "http://www.yourhomepage.com";</script>

Redirect image links from old blog (Wordpress multisite)

I have the following scenario:
Everything runs on a wordpress multisite
I used to have a blog on domain A
The blog posts from domain A got transferred to a new blog on domain B. The images on this new blog were still pointing to domain A and were working fine, until...
I created a new website on domain A with a different ID
Now the images on domain B point to domain A, to the upload folder of the old ID and they don't work anymore. I just copied the files from the old blog over to my new blog's ID's upload folder.
Now I guess I need to edit my htaccess file, which is the reason for this question. What's the code I need to use and where do I put it (I guess it goes in the main WP htaccess file)?
I need to redirect all image links from
http://domaina/wp-content/uploads/sites/5/XXXX/XX/XXX.xxx
to
http://domainb/wp-content/uploads/sites/9/XXXX/XX/XXX.xxx
I guess an alternative would be to do it in SQL and rewrite the permalinks, but that's quite high risk and I would prefer the htaccess solution...
If you want to use .htaccess than just put the redirects following the example
Redirect 301 /old-page.html http://new-domain.ru/new-page.html
and yes, use the main .htaccess in the root WP directory

Wordpress - subdomain to root

I've been building a wordpress site on a subdomain while having my old website in the root directory. Now I have finished the site and would like to move it into the root. Is there a way how to 'redirect' my site so I don't need to move all the files and databases from the subdomain? The address should appear as www.myweb.com, though.
I have these folders in my FTP:
public_html, _sub, tmp
The subdomain is currently located at _sub/wc/
Thanks!
This codex article should explain the process, I've used it successfully myself several times: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre-existing_subdirectory_install
According to wordpress you can leave your files where they are and put the following into your wp-config file:
define('WP_SITEURL', 'http://www.example.com/new/');
define('WP_HOME', 'http://www.example.com/new/');
Or you can:
In the box for WordPress address (URL): change the address to the new
location of your main WordPress core files. Example:
http://example.com/wordpress
In the box for Site address (URL): change
the address to the root directory's URL. Example: http://example.com
Take a look at moving wordpress: Moving_WordPress and editing the wp-config Editing_wp-config.php as well as Giving_WordPress_Its_Own_Directory
Wordpress gives a lot of information about moving domains etc, and it is well worth reading their documentation on the matter.
You may want to remove your old website files (it is good to have a back up of the old version anyway) so that they do not conflict (esp if they are WordPress).

Resources