titel Posted April 21, 2007 Share Posted April 21, 2007 Hi everybody, I'm building a website for my NGO and I'm trying to create an redirect from some sub domains to the main website using .htaccess redirects. What I've got already working is RewriteCond %{HTTP_HOST} ^aiesec\.org.mk$ [NC] RewriteRule .* http://www.aiesec.org.mk/ [L,R=301] redirecting all from aiesec.org.mk to www.aiesec.org.mk RewriteCond %{HTTP_HOST} ^skopje\.aiesec\.org.mk$ [NC] RewriteRule .* http://www.aiesec.org.mk/skopje/ [L,R=301] redirecting all from skopje.aiesec.org.mk to www.aiesec.org.mk/skopje What I'm trying to achieve now, is to also keep into account what comes after the first part of the URL while redirecting. At the moment if you type skopje.aiesec.org.mk/whatever you'll be redirected to www.aiesec.org.mk/skopje, instead of www.aiesec.org.mk/skopje/whatever Thank you in advanced, tite Quote Link to comment Share on other sites More sharing options...
NikLP Posted April 22, 2007 Share Posted April 22, 2007 I'm also looking for this functionality. I have a post (buried somewhere in) here at http://groups.drupal.org/node/2348 along the same lines. I've received some advice but it didn't work as planned. I'm confused as to why this should be so difficult - after all it seems a very reasonable request. If someone does find a working method, perhaps they could cross-post to that thread too, please? Thanks. Quote Link to comment Share on other sites More sharing options...
titel Posted April 23, 2007 Author Share Posted April 23, 2007 Thanks a lot NikLP, After a few days of searching on internet and posting on multiple forums without tangible results I finally made this work. After reading the thread you indicated I finally managed to implement what I initially wanted using the following script. RewriteCond %{HTTP_HOST} ^aiesec\.org.mk$ [NC] RewriteRule ^(.*)$ http://www.aiesec.org.mk/$1 [R=301,L] Which redirects all the http://aiesec.org.mk including the URL parts afterwards to http://www.aiesec.org.mk RewriteCond %{HTTP_HOST} ^skopje\.aiesec\.org.mk$ [NC] RewriteRule ^(.*)$ http://www.aiesec.org.mk/skopje/$1 [R=301,L] Which redirects all the http://skopje.aiesec.org.mk including the URL parts afterwards to http://www.aiesec.org.mk/skopje Hope you'll manage to fix it as well, titel Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.