Forum Discussion
how to publish wordpress subsite from root / - URI Masking
Hi everyone,
I have been tasked to publish a wordpress site (myapp)
from the root of the domain
however it has been installed myapp.mysite.com/wordpress/
yes, the development life cycle was.
1) lets do a 'test', 2) works great 3) just make this 'test' the PROD thanks,
I am confident that it would be possible to do f5 magic to serve
the subsite at http://myapp.mhsite.com/
aka URI masking for the wordpress instance which has been installed under /wordpress
has anyone done this already ?
there is already another app published on same server,
from the root under different URL (otherapp.mysite.com)
www server IP (node) = 1.2.3.4
DNS myapp.mysite.com. resolves to IP 1.2.3.4 ( to be published new VS y.y.y.y )
DNS otherapp.mysite.com resolves to IP 1.2.3.4 ( published under existing VS z.z.z.z )
server is IIS 7.5, perhaps it's possible on the IIS, with referrer or similar, I don't have direct access to server and enjoy the challenge/pain.
I've been crawling through devcentral today and the closest i got to masking the obscure /wordpress URI
was to replace the /wordpress with /myapp.
this looks more meaningful but is still suboptimal.
any assistance would be very welcome.
first time poster,
Chris
3 Replies
Have to ask, can't you just move the wordpress application to the root instead? There are multiple articles out there on how to do this.
Here's one:
https://wordpress.org/support/topic/moving-wordpress-from-subfolder-to-root-folder
That said, you CAN rewrite the incoming requests to append "/wordpress" with an iRule:
when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] set host [string tolower [HTTP::host]] Make sure that the site accessed is myapp.mhsite.com if { $host -eq "myapp.mhsite.com" } { Add a the wordpress folder to the request for the backend calls if the wordpress path is not there already if { ! $uri starts_with "/wordpress" } { HTTP::uri "/wordpress$uri" } } }But this would not handle the outgoing response containing links to /wordpress. For that you'd need to enable a stream profile which replaces /wordpress with "":
https://support.f5.com/kb/en-us/solutions/public/8000/100/sol8115.html
Hope I understood your question properly. 🙂
/Patrik
- Kevin_Stewart
Employee
So if I understand your question, your app is accessible with the /wordpress URI prefix, but you want it externally accessible as simple "/". In order to make this work you have to do a few things:
-
You have to make sure that all response content (HTTP headers and payload) with this URI are mapped from /wordpress to /
-
You have to rewrite the URI prefix from / to /wordpress[HTTP::uri] on each incoming request.
So let's take a look at what that iRule might look like:
when HTTP_REQUEST { don't let the server compress responses HTTP::header remove Accept-Encoding disable STREAM for requests STREAM::disable rewrite URI if it doesn't start with /test if { not ( [string tolower [HTTP::uri]] starts_with "/wordpress" ) } { HTTP::uri "/wordpress[HTTP::uri]" } } when HTTP_RESPONSE { catch and replace redirect location headers if { [HTTP::header exists Location] } { HTTP::header replace Location [string map -nocase {"/wordpress" "/"} [HTTP::header Location]] } enable STREAM to replace payload URI content STREAM::expression {@/wordpress@@} STREAM::enable }This is a simple example, so you may have to tweak a little to get it just right, but hopefully it makes sense. You can also accomplish most/all of this with URI-translation rewrite profile if you're running a newer version of BIG-IP.
-
- chrispr_172493
Nimbostratus
thank you Kevin and Patrik, makes sense, I'll persist with it. thus far when i peel back the /wordpress i get otherapp.mysite.com. I'm on the right track thou... thanks
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com