[ic] rewrite/redirectmatch

Steve & Patti Getzinger steveandpatti@wubs.org
Mon, 18 Dec 2000 16:46:12 -0600


I used this when originally posted and works great but you forgot the part about
the images :) Here is a complete from my httpd.conf as done per what was posted
to the list. I asked Bill about the images on initial post and he supplied to me
and posted to the list. By the way this is Apache just for the record.

<VirtualHost 123.456.789.0>
    ServerAdmin webmaster@somedomain.com
    DocumentRoot /path/to/html/root
    ServerName somedomain.com
    ErrorLog logs/somedomain_error_log
    CustomLog logs/somedomain_access_log common
    CustomLog logs/somedomain_agent_log agent
    CustomLog logs/somedomain_referer_log referer
    ScriptAlias /cgi-bin/ "/path/to/cgi-bin/"
    RewriteEngine On
    RewriteRule    ^$      /cgi-bin/vlink/index.html       [PT,L]
    RewriteRule    ^/$     /cgi-bin/vlink/index.html       [PT,L]
    RewriteRule    ^/index\.html$      /cgi-bin/vlink/index.html   [PT,L]
    RewriteRule    ^/cgi-bin/vlink/.*   -  [PT,L]
    RewriteRule     ^/.*images/.*   -       [PT,L]
    RewriteRule    ^/(.*)      /cgi-bin/vlink/$1   [PT,L]
</VirtualHost>

Steve

Bill Randle wrote:

> On Dec 15,  9:19pm, Victor Nolton wrote:
> } Subject: [ic] rewrite/redirectmatch
> } looking for some help with a redirectmatchor rewrite.
> }
> } I want to redirect whatever is requested at
> } http://www.somedomain.com
> } to http://www.somedomain.com/cgi-bin/store
> }
> } so if they goto http://www.somedomain.com/links
> } they end up at
> } http://www.somedomain.com/cgi-bin/store/links
> }
> } same with the flypage
> } http://www.somedomain.com/01-0110
> } would be
> } http://www.somedomain.com/cgi-bin/store/01-0110
> }
> } I am not very good with this rewrite stuff but I managed to find this code.
> }
> } rewriterule ^/([0-9]+)$ /cgi-bin/<storename>/$1
> }
> }-- End of excerpt from Victor Nolton
>
> There should be a note about this in the mailing list archives.
> I don't remember exactly when I posted it, so here's a copy of
> a set of Apache ReWrite rules that should do what you want.
>
> <VirtualHost my.virtual.ip.address>
>     # standard virtual domain stuff goes here
>     ...
>     # set directory path to the cgi-bin directory for this domain
>     # (in this case, it's the same as the system cgi-bin directory
>     ScriptAlias /cgi-bin/ "/home/httpd/cgi-bin/"
>     # rewrite external URLs to internal pathnames
>     # Note that the [PT] (Pass Thru) flag is used to let the
>     # /cgi-bin/ part of the replacement string to be evaluated by
>     # by the ScriptAlias rule. Alternatively, we could just put
>     # the complete directory path in there, but the former is
>     # more portable.
>     RewriteEngine On
>     # comment out the next two rewrite rules if you want to have
>     # a splash page prior to going to the home page for this catalog
>     # matches on http://myhost.com
>     RewriteRule ^$              /cgi-bin/store/index.html        [PT,L]
>     # matches on http://myhost.com/
>     RewriteRule ^/$             /cgi-bin/store/index.html        [PT,L]
>     # don't change URLs like http://myhost.com/cgi-bin/store/*
>     RewriteRule ^/cgi-bin/store/.*       -                       [PT,L]
>     # default rule change http://myhost.com/somepage to
>     # /cgi-bin/store/somepage
>     RewriteRule ^/(.*)          /cgi-bin/store/$1                [PT,L]
> </VirtualHost>
>
>         -Bill
>
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users

--
=========================================================
  WDI                          Steve & Patti Getzinger
  702 Lincolnway West          steveandpatti@wubs.org
  South Bend, IN  46616        http://www.wubs.org/
  219-287-4700 (Main Office)   317-535-0239 (Direct Line)
=========================================================