1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mod_rewrite

Discussion in 'HTML, Graphics & Programming' started by JonD, 21 Jul 2006.

  1. JonD

    Wise Guy

    Joined: 26 Jun 2003

    Posts: 1,142

    Location: North West

    OK I have a domain:

    http://www.mydomain.co.uk

    Now I mod rewrite so all my pages:

    /index.php?p=portfolio&id=3
    are written as:
    /portfolio/3/

    This is what I have

    Code:
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^about/?$			index.php?p=about
    RewriteRule ^portfolio/?$		index.php?p=portfolio
    RewriteRule ^portfolio/([0-9]+)/?$	index.php?p=portfolio&id=$1
    RewriteRule ^cv/?$			index.php?p=cv
    RewriteRule ^project/?$			index.php?p=project
    RewriteRule ^photos/?$			index.php?p=photos
    RewriteRule ^contact/?$			index.php?p=contact
    
    but I want to have a subdomain called portfolio:

    http://portfolio.mydomain.co.uk

    but if I navigate to http://www.mydomain.co.uk/portfolio/, it automatically goes to the subdomain folder, not index.php?p=portfolio

    Is there a way to stop this without having a different name of subdomain?

    Thx