I have a Wordpress multisite project and the multisite network is configured as subdirectory.
Let's say - domain.com/site1, domain.com/site2 (which are working properly).
The server is also configured for wildcard-subdomain.
Now, if I try with req.domain.com or req1.domain.com/site1 or req2.domain.com/site2 then it always redirect to domain.com.
I checked the requested domain name (say for- req.domain.com) by print from <root dir>/index.php, and up to this /index.php the domain name (req.domain.com) is OK; but it redirected (to domain.com) before theme files start to execute.
Is there any way to use both wildcard-subdomain and multisite (subdirectory) simultaneously?
Related
I've searched and haven't been able to find an answer to this. A lot of the information I've found appears to be out of date.
I have a Bitnami wordpress installation, running Apache on a lightsail instance.
I have multiple different domains resolving to the server. At the moment, each domain displays in the browser if you use it
eg
website-address.com - displays in browser
website-address.org - displays in browser
etc
I just want website-address.com to display in the browser with any other domains redirecting to that.
It seems that 301 redirects are not managed by htaccess files any more. As far as I can tell, this should be configured using the virtual hosts configuration in the bitnami.conf file
I currently have two vhosts in that file, one for port 80 and one for 443
There are a number of rewrite conditions in there, rewriting things like www to non www and http to https, all of which work.
I have configured the ServerName to the domain that I want in both virtual hosts and the ServerAlias to match all of the other urls
I have also tried adding:
RewriteCond %{HTTP_HOST} !^{SERVER_NAME}
RewriteRule ^(.*)$ https://{SERVER_NAME}/$1 [R,L]
but the alternate domains are still not redirecting.
Is there something else I need to add? Do I need to configure a vhost for each of the alternate domains and if so, do I just do it for 443 or do I need to do it for port 80 as well?
I need to wordpress from 2 url, my main wp already run in subdomain wp.domain.com but I can't access from domain.com/wp, I try some change in database and .httaccess file, but I can't run it with 2 url
I need can access both of them :
wp.domain.com
domain.com/wp
WordPress doesn't really support this setup. All posts have saved their URL in the database, if you display the site on the secondary URL all links will still point to the primary URL.
Additionally, displaying the same content on different domains (what this is) is usually penalized by search engines, which is something you usually want to avoid.
You can achieve this by configuring the Apache with mod_proxy and mod_proxy_html to proxy all requests on one domain to the other, rewriting the URLs in the process.
The Apache config for this looks like this:
ProxyPass /wp/ http://wp.domain.com/
ProxyPassReverse /wp/ http://wp.domain.com/
# to rewrite the URLs in the HTML
ProxyHTMLEnable On
ProxyHTMLExtended On
ProxyHTMLURLMap http://wp.domain.com https://domain.com/wp
But I'd recommend to stick to a single URL and configure Apache to redirect all requests on the secondary URL to the primary.
You can do that with a single line in a .htaccess:
RewriteRule ^(.*)$ http://wp.domain.com/$1 [R=301,L]
I want to access my single worpress installation site via multiple subdomain without using multisite functionality.
What i have tried, but i have not found the perfect solution:
I have used the MultiDomain plugin but it restricted me to add the multiple domain in array through hardcode, actually i want the subdomain ui plugins that help me to add multiple subdomain like "myname.example.com" to redirect in main wordpress website i.e "example.com".
Thanks in advance
You can configure that easily in apache using NameVirtualHost, no need for a WordPress plugin.
<VirtualHost *:80>
ServerName *.example.com
# for a single subdomain:
#ServerAlias myname.example.com
Redirect permanent / http://example.com
</VirtualHost>
If you don't have direct access to your apache config, you can configure *.example.com to it's own document root (how to do that depends on you hoster, can't give you any concrete examples) and configure the redirect in a .htaccess file:
RewriteEngine On
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
I have a wordpress site running at the root of my domain. e.g http://www.example.com as I needed site to run www url I had changed the siteurl in wp-options table to http://www.example.com now when I try to visit non www url it redirects me to www variation. this is all working fine
But now I have created a subfolder 'app' there which serves an angular app. Now when I visit http://example.com/app/ then it works.. but when I visit http://www.example.com/app/ it shows me wordpress 404 page. is it not possible to have this setup?
Server is aws + apache.
If you're using an .htaccess file you can add this before the rewrite rule for wordpress index.php
RewriteCond %{REQUEST_URI} ^/app/.*$
RewriteRule ^(.*)$ $1 [L]
It checks if the requests start with app/ and pass it without modification.
Please check angular app where to serve, means which port on run and also check your main wordpress site where?
While accessing my WordPress website, I got directory listing error. I can access the site using http://example.com/index.php but not when I use http://example.com. I also tried put the .htaccess file in the directory. I had following code in my .htaccess file.
#BEGIN WordPress
#END WordPress
DirectoryIndex index.php
I solved it... If any want to change your site path not having access to control panel in your db go to the wp-options table change your site url link to http://www.example.com to the http://www.example.com/index.php