Results 1 to 5 of 5

Thread: rewrite question

  1. #1
    Join Date
    Jan 2010
    Beans
    45
    Distro
    Ubuntu 13.04 Raring Ringtail

    rewrite question

    Hello all,
    I have a problem and i hope you all can help.

    I have made a rewrite rule for a subdomain
    Code:
    <VirtualHost *:80>
    DocumentRoot "/var/www/subdomain/document"
    ServerName subdomain.domain.nl
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.nl$
    RewriteRule ^/(.*)$ http://domain.nl/document/%1.html [L,R]
    <Directory "/var/www/domain/document">
    allow from all
    Options +Indexes
    </Directory>
    </VirtualHost>
    my problem is
    when i go to http://subdomain.domain.nl the new url becomes http://domain.nl/document/subdomain.html

    what i want is that when i go to http://subdomain.domain.nl the page with the name like the subdomain is loaded without the long url.

    What have i made wrong.
    Last edited by PaulNL; August 5th, 2011 at 10:02 AM.

  2. #2
    Join Date
    Nov 2007
    Beans
    297
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: rewrite question

    Umm... I'm not quite sure what you're wanting. Are you saying you want http://subdomain.domain.nl to TRANSPARENTLY rewrite to http://domain.nl/documents/subdomain.html rather than changing the URL in the address bar? Is that your problem right now? If so, try changing the R in your rewrite rule to PT.
    Last edited by Beacon11; August 5th, 2011 at 01:35 PM.

  3. #3
    Join Date
    Jan 2010
    Beans
    45
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: rewrite question

    Yes i want to make it dynamic so when a page is not in the folder he has to use the default and when the page exist he has to use it. So for sub1.domain.nl he has to use sub1.html as first page, and for sub2.domain.html he has to use sub2.html.

    So i don't have to make a lot of subdomains

    PAul

  4. #4
    Join Date
    Nov 2007
    Beans
    297
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: rewrite question

    Okay, did you try changing the R in your rewrite rule to PT?

  5. #5
    Join Date
    Nov 2007
    Beans
    297
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: rewrite question

    Also, I bet your question would get more eyes if you changed the subject to something involving Apache (e.g. Need Help With Apache Rewrite Module).

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •