need some help with a .htaccess rewrite rule..

Discussion in 'Server Operation' started by edge, Jul 21, 2006.

  1. edge

    edge HowtoForge Supporter

    I'm trying to do the following with a .htaccess rule (apache2), but till now with no luck. should show should show

    I would also (if possible) to still show "" as URL, and not redirect it to "" (same thing for

    I guess it's done with a rewrite rule.. but how?

    Thanks for any info..
  2. TheRudy

    TheRudy ISPConfig Developer

    Don't think you can do that since by default you don't have wildcard set for subdomains i think.. Try by inserting that code to vhosts.conf file. There it should work since ISPConfig does it the same way if you create a co-domain.
  3. edge

    edge HowtoForge Supporter

    Thanks for the input TheRudy.

    I was using the Vhosts_ispconfig.conf to do this, but I was kind of hoping that this could be done with a .htaccess file!
    Last edited: Jul 21, 2006
  4. edge

    edge HowtoForge Supporter

  5. TheRudy

    TheRudy ISPConfig Developer

    R = redirection aka from typed URL to the one you provide in the rule.. You wanted it to stay subdomain, no? :)
  6. edge

    edge HowtoForge Supporter

    Oops... yes.. I wanted to stay in the subdomain.. Lets try without the [R] :)
  7. falko

    falko Super Moderator

    You can put the code into the Apache Directives box of the web site in ISPConfig, or you use an .htaccess file (but then you might have to change the AllowOverride line in your main Apache configuration for the /var/www/*/web directory near the end).
  8. edge

    edge HowtoForge Supporter

    Got it!

    RewriteEngine On 
    RewriteCond %{REQUEST_URI} !^//(.*)?$ 
    RewriteCond %{HTTP_HOST}  ^(www\.)?([^.]+)\.website\.com$ [NC] 
    RewriteRule ^(.*)$ //%2/$1 [QSA,L]
    url: "" will now load the stuff that is in "" and still show "" as url

    url: "" will now load the stuff that is in "" and still show "" as url

Share This Page