mod_rewrite admin.domain.nl, *.domain.nl

Discussion in 'Apache' started by bas_vdl, Nov 3, 2009.

  1. #1
    Hello,

    i'm trying to put a htacces file togeter with the folowing functionalities.

    1. Always remove the www part from the addressbar in the browser. For now the script is working for domain.nl but not for sub.domain.nl or admin.sub.domain.nl
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    Code (markup):
    2. http://admin.domain.nl >> http://admin.domain.nl/admin.php. not sure if this is working?
    RewriteCond %{HTTP_HOST} ^admin.domain.nl$ [NC]
    RewriteRule ^(.*)$ http://admin.domain.nl/admin.php$1 [R=301,L]
    Code (markup):
    3. http://*.domain.nl >> http://domain.nl/search/* (* can be everything, except admin)
    need some help for this

    4. http://domain.nl >> http://domain.nl/index.php
    is normall behavior ;)

    Thank you in advance.

    Regards

    Bas
     
    Last edited: Nov 3, 2009
    bas_vdl, Nov 3, 2009 IP
  2. bas_vdl

    bas_vdl Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    two things ar not working yet:

    - admin.parkdomain.nl >> goes to http://admin.parkdomain.nl/admin.phpadmin.phpadmin.php etc
    - www.admin.parkdomain.nl >> this wil redirect the user to my hosting companies websiteinstead of admin.parkdomain.nl/admin.php

    <IfModule mod_rewrite.c>
    RewriteEngine on
    
    # Redirecting www version to non-www version
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    
    # Redirecting admin to admin.php
    # Redirecting admin to admin.php
    RewriteCond %{HTTP_HOST} ^admin.parkdomain.nl$ [NC]
    RewriteRule ^(.*)$ http://admin.parkdomain.nl/admin.php$1 [R=301,L]
    
    # If subdomain
    RewriteCond %{HTTP_HOST} ([^\.]+)\.parkdomain\.nl$
    # Check that the subdomain part is not www and ftp and mail
    RewriteCond %{HTTP_HOST} !^(admin|www|ftp|mail)\.parkdomain\.nl$
    # Redirect all requests to a php script passing as argument the subdomain
    RewriteRule ^.*$ http://parkdomain.nl/search/%1 [R=301,L]
    </IfModule>
    Code (markup):
     
    bas_vdl, Nov 3, 2009 IP