Reputation: 5415
I'm forced to install wordpress on a subdomain (http://lnx.domain.tld), since www points to a windows server where there are other web apps that I need not to touch.
What I wish would be a clean, seo oriented way to rewrite the url so that it appears in a subfolder http://www.domain.tld/newsite.
Any suggestion/example?
EDIT: it's just not possible to run wordpress from www
Upvotes: 1
Views: 726
Reputation: 1761
This could be another solution. Have you tried Wordpress for Windows?
If the size of your blog is not that big, you might want to consider installing that. Then import the content.
Upvotes: 0
Reputation: 1761
This is possible IF you can put a load balancer on top of your WordPress and IIS servers. You can assign your domain to it and configure it to route requests based on the URL pattern. It still depends on how flexible your hosting provider is---the load balancer needs to be able to "see" the other 2 on the network to send/route the requests.
My answer is based on experience as I had exactly the same requirements as yours. I am serving a blog and an IIS website under the same domain. I have a load balancer (HAProxy) on top of my IIS and WordPress machines. It is configured to route requests to different servers based on the URL pattern.
Example:
In config, it should look something like this:
# Frontends
frontend www
bind xx.xx.xx.xx:xx
mode http
option httpclose
default_backend iis_webserver
# this is the condition
acl blog-request path_beg -i /blog
# route to a different machine if it's a blog
use_backend blog_webserver if blog-request
# Backends: These are the machines that can accept requests.
backend iis_webserver
...settings...
server server1 xx.xx.xx.xx:xx check
server serverN xx.xx.xx.xx:xx check # (if you have more than one server)
backend blog_webserver
...settings...
server server1 xx.xx.xx.xx:xx check
server serverN xx.xx.xx.xx:xx check # (if you have more than one server)
Upvotes: 1
Reputation: 41
@ Francesco, I think I need to clarify that your new "URL" is a sub-directory. @ Kjuly, in this case, Francesco doesn't actually need to move his blog folder. He asks for a SEO friendly way to rewrite URL. So the first thing comes into my mind is .htaccess 301 direction.
e.g.
RewriteEngine On
Options +FollowSymLinks
#test sub domain
RewriteCond %{SERVER_NAME} ^(www.)?subdomain.mydomain.com [NC]
#avoiding repetitive redirection
RewriteCond %{REQUEST_URI} !^/subdomain/ [NC]
#redirect to subdirectory
RewriteRule ^(.*)$ subdomain/$1 [L]
Notice, if you use this method, you cannot create a directory with the name "subdomain" under //subdomain.mydomain.com/, or it can't be visit through this domain, as it's in use by someone else.
Upvotes: 0
Reputation: 35161
You can just put your wordpress root fold
at your host wwwroot/
.
Then login your admin panel(visit:http://www.domain.tld/newsite/wp-login.php), in your config area, set the wordpress URL to http://www.domain.tld/newsite
and set the site URL to http://www.domain.tld/newsite
, too.
Upvotes: 0