I have a CodeIgniter website in my server root directory. This website does have a lot of pages approx ~2M to ~2.5M pages with lots of other functionality. However; now I have developed one WordPress multisite for my home page and another 12 landing page. I've used WPML for the same. now I need to accomplish the following structure,
domain.com -> My CodeIgniter website.
lp.domain.com -> WordPress multisite main site.
ex1.lp.domain.com to ex11.lp.domain.com -> for my 12 landing page.
Now, When I am migrating the WordPress installation to the subdomain then it's getting in a redirection loop.
Can anyone help me with a solution that I can do for the same?
Appreciate your help in advance
use a rewrite in the CI mainsite (after CI's rewrite script),
RewriteEngine On
RewriteCond %{HTTP_HOST} (.*)\.domain\.tld$
RewriteCond %{HTTP_HOST} domain\.tld$
RewriteCond %{HTTP_HOST} ^domain\.tld[NC]
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.tld$
RewriteCond %{HTTP_HOST} !^(lp|subdom1|sub2dom2)\.domain\.tld$ [NC]
then a permanent redirect to,
RewriteRule ^(.*) https://www.domain.tld/%1/$1 [L,R=302]
and then in WP,
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
the live example is here with CI, https:// www.gsunitedtechnologies .com (subdomain : https:// blog.gsunitedtechnologies .com and the same host with a multisite wp network on https:// beatthedrumfor. com (subdomain: https:// in.beatthedrumfor. com)
Related
Currently I am setting up a WordPress Multisite. Every customer will have their own subdomain.
So in this example our site is called: www.example-site.de. One customer will have his own domain called "www.customerxy.example-site.de"
Unfortunately, sometimes the subdomains redirect to the main domain. If I type "https://customerxy.example-site.de" I was not able to reproduce the problem. Just when I typed "customerxy.example-site.de". I do not know if this has anything to do with it, but this was something I noticed.
I already wrote that it could be, because subdomain and main domain are pointing on the same folder. The .htaccess file shows the following:
"
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^(.*)$ https://customerxy.example-site.de/$1 [R=301,L]
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
# END WordPress
"
If some1 has any idea how to fix this that sometimes the subdomains redirect to the main domain, I'd be so glad. Thank you for every help in advance!
Best regards
Benjamin
Search all internet, try many redirect versions, but no one works for my wordpress site.
Ok! I have 3 domains:
www.domain1.lv (this is a default domain)
www.domain2.eu (these two are new domains)
www.domain3.eu
When i go to domain1 it opens http://www.domain1.lv/lat/ (default language page).
So, when i go to domain2 or domain3 i want that it opens http://www.domain2or3.eu/eng/ (english site version). If it not possible, it can redirect to http:// www.domain1.lv/eng/
At the moment, when i open new links, it redirects to default domain with some strange random page in it..
My .htaccess file:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
In your domain 2 or domain 3 htaccess, put
Redirect 301 / http://www.domain2or3.eu/eng/
Ok, here is the situation i can´t solve:
I have a WP multisite running on a server with 3 domains and 3 sites, and in that server i also have a subdomain running it´s own WP.
So, let´s say i have this MU sites:
site_1.com
site_2.com
site_3.com
And also i have this subdomain:
blog.site_1.com
The thing is if i go to this url: "site_2.com/blog" it show me the page using a 404 template with the subdomain theme style. Yeah!!
So, trying to access "site_2.com/blog", give me 404 using a theme that is in use on a subdomain named "blog" that is live over: blog.site_1.com.
My MU htaccess has this:
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
RewriteCond %{HTTP_HOST} ^blog.site_1.com [OR]
RewriteCond %{HTTP_HOST} ^www.blog.site_1.com$
RewriteRule ^(.*)$ http://site_1.com [R=301,L]
Last 3 lines are obviusly required in order to have a diferent WP instalation running on that subdomain that is actualy the "blog" folder on my public_html.
Also that "blog/" folder (where is installed the site under blog.site_1.com) has this default wp htaccess code:
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Maybe thats the problem, i have for one part a multisite running with 3 domains maping into the same server, but also on another part a subdomain running it´s own wp instalation and, badly, in this case i builded a page named "blog" that conflict with the "blog" folder that is actualy another site ?¿?¿?¿ jejej, it´s crazy, and at this point this is personal :) i need to know why i can´t make this working ok.
Any idea on how i can solve this thing? Thanks
I have a Joomla website on root-level, and wordpress blog on /blog .
Inside root-level .htaccess, I need to implement non-www to www redirect, such as:
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
However, this causes a problem when going to www.example.com/blog (withoug trailing "/" at the end). I get redirected to http://www.example.com/cgi-bin/php53.cgi/blog/index.php
The php53.cgi file is there to turn on PHP 5.3 version. This is the content of that file:
#!/bin/sh
export PHP_FCGI_CHILDREN=3
exec /hsphere/shared/php53/bin/php-cgi
This is the .htaccess inside /blog directory:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
# END WordPress
You will need to redirect non-www to www on both .htaccess since the later .htaccess will overwrite your Joomla .htaccess rules.
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
As for the blog not ending with / you could try this rule at your Joomla .htaccess:
# Redirect /blog to /blog/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+blog([^\s]+) [NC]
RewriteRule ^blog$ /blog/? [R=301,L]
NOTE: I am using %{THE_REQUEST} because since I don't know what rules you have on your Joomla .htaccess, the above will most likely work on all cases.
But you could also do it in a simpler way but that will not work in all cases depending on what other rules you have:
# Redirect /blog to /blog/
RewriteRule ^blog$ /blog/? [R=301,L]
On my server I've got a single WordPress installation for my own company website.
Besides that, I would like to create a demo area for clients.
At the moment I've got the following setup and folders:
www.domain.com - Single WordPress installation for company website
www.domain.com/demo/ - WordPress Multisite
At the moment all the clients websites have the following domain structure:
www.domain.com/demo/client1, www.domain.com/demo/client2, etc.
Instead of those long urls, I would like a subdomain:
demo.domain.com/client1, demo.domain.com/client2, etc.
WordPress Multisite standard generates the following .htaccess:
RewriteEngine On
RewriteBase /demo/
RewriteRule ^index\.php$ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
From other topics at stackoverflow I've found the following:
RewriteRule ^demo/(.*) demo.domain.com/$2/
But unfortunately this doesn't work. Anybody who can help me?
Thanks in advance!
Keep the multisite .htaccess where it is and put this in the .htaccess in the root of your web directory:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^demo
RewriteRule ^(.*)$ http://www.domain.com/demo/$1