ReWrite Rules

This is a discussion on ReWrite Rules within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi, Currently my homepage is http://www.indigoclothing.com/index.shtml However I would now want my homeapge to be: ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-14-2003
Alex
 
Posts: n/a
Default ReWrite Rules

Hi,

Currently my homepage is http://www.indigoclothing.com/index.shtml

However I would now want my homeapge to be:
http://www.indigoclothing.com/cgi-bi...&page=homepage

The dynamic page is different from the static one as the featured
products on the right of the page change each time the page is
refreshed.

Can a rewrite rule or something be used so that if
www.indigoclothing.com is typed in, the user is taken to my dynamic
page but as far as Google is concerned it does not look like a dynamic
url?

Someone in another forum
(http://www.gossamer-threads.com/perl...=unread#unread)
recommended using:

RewriteRule ^/$ /cgi-bin/page.cgi?d=1&page=homepage [PT]


But this doesn't seem to work. I know mod_rewrite works as I already
have the following in my htaccess:

RewriteEngine on
RewriteRule ^.*L([0-9]+)/?$ /printing-embroidery/Detailed/$1.html [L]

I have reset my cache and tried it from a different computer so that
option is ruled out. If I delete my original index.shtml I get a 403
Fordidden.

Can anyone help?
  #2 (permalink)  
Old 07-14-2003
Justin Koivisto
 
Posts: n/a
Default Re: ReWrite Rules

Alex wrote:
> Hi,
>
> Currently my homepage is http://www.indigoclothing.com/index.shtml
>
> However I would now want my homeapge to be:
> http://www.indigoclothing.com/cgi-bi...&page=homepage
>
> The dynamic page is different from the static one as the featured
> products on the right of the page change each time the page is
> refreshed.
>
> Can a rewrite rule or something be used so that if
> www.indigoclothing.com is typed in, the user is taken to my dynamic
> page but as far as Google is concerned it does not look like a dynamic
> url?


How about something like:

RewriteEngine On
RewriteBase /
RewriteRule ^/?$ /cgi-bin/page.cgi?d=1&page=homepage [PT,L]
RewriteRule ^index.shtml$ /cgi-bin/page.cgi?d=1&page=homepage [PT,L]

> RewriteRule ^.*L([0-9]+)/?$ /printing-embroidery/Detailed/$1.html [L]


This rule looks a little strange...
Anything that ends in numbers and preceeded by an 'L' gets re-written.
For instance, these would all be rewritten:

/HI_AL0
/L123423463574585467957894676345243
/some/dirty/words/BALL23

I would assume that there should be more of a restriction on the format
of that one...

--
Justin Koivisto - spam@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

  #3 (permalink)  
Old 07-15-2003
stephan beal
 
Posts: n/a
Default Re: ReWrite Rules

Alex wrote:
> Can a rewrite rule or something be used so that if
> www.indigoclothing.com is typed in, the user is taken to my dynamic
> page but as far as Google is concerned it does not look like a dynamic
> url?


We had a similar problem in our company, and couldn't use the standard
approaches because of the loading order of mod_rewrite and mod_jk (we rely
on mod_jk being first). We eventually write a RewriteMap which actually
creates the "static-looking" links on the fly by decoding the dynamic
links. The static content is simply a one-line stub file which looks
something like:
<!--#include
virtual="/webappname/doDeliverPage.do?template=$tmpl&cpid=$cpname&layou t=$layout"
-->

(the vars are replaced by the perl-powered RewriteMap)

(http://www.gossamer-threads.com/perl...=unread#unread)
> recommended using:
>
> RewriteRule ^/$ /cgi-bin/page.cgi?d=1&page=homepage [PT]


AFAIK [P] won't work when the destination is the same server.

> Can anyone help?


i toyed for a long time with this and the only way i got working (again, due
to our requirements involving mod_jk) was to use mod_rewrite to actually
create content, instead of simply rewriting.

Example:

User goes to:
http://foo.com/dynamic_looking_link.html

Rewrite passed that to our RewriteMap, which then creates a dummy file (if
it doesn't exist) which does a "virtual" import of:
/real/path/to/my/content?foo=bar&one=two

The user still sees the static-looking URL. We use paths to denote
parameters to be passed via the dummy page:
http://foo.com/appname/somearg/anotherarg
which would then be translated into the file:
<docroot>/appname/somearg/anotherarg/index.shtml
which contains
something like:
<!--#include
virtual="/webappname/doDeliverPage.do?arg1=somearg&arg2=anotherarg" -->

Note that the RewriteMap does NOT actually rewrite anything! Instead it
generates the content the user thinks he asked for.


--
----- stephan beal
Registered Linux User #71917 http://counter.li.org
I speak for myself, not my employer. Contents may
be hot. Slippery when wet. Reading disclaimers makes
you go blind. Writing them is worse. You have been Warned.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:39 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0