Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

ReWrite Rules

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  VirtualHosts  
Author Message
alexwalker

External


Since: Jul 14, 2003
Posts: 1



(Msg. 1) Posted: Mon Jul 14, 2003 12:53 pm
Post subject: ReWrite Rules
Archived from groups: alt>apache>configuration (more info?)

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-bin/page.cgi?d=1&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/gforum/gforum.cgi?post=226784;sb=post_latest_reply;so=ASC;forum_view=forum_view_collapsed;;page=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?

 >> Stay informed about: ReWrite Rules 
Back to top
Login to vote
spam3

External


Since: Jul 01, 2003
Posts: 411



(Msg. 2) Posted: Mon Jul 14, 2003 10:24 pm
Post subject: Re: ReWrite Rules [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Alex wrote:
 > Hi,
 >
 > Currently my homepage is <a style='text-decoration: underline;' href="http://www.indigoclothing.com/index.shtml" target="_blank">http://www.indigoclothing.com/index.shtml</a>
 >
 > However I would now want my homeapge to be:
<font color=purple> > <a style='text-decoration: underline;' href="http://www.indigoclothing.com/cgi-bin/page.cgi?d=1&page=homepage</font" target="_blank">http://www.indigoclothing.com/cgi-bin/page.cgi?d=1&page=homepage</font</a>>
 >
 > 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
 > <a style='text-decoration: underline;' href="http://www.indigoclothing.com" target="_blank">www.indigoclothing.com</a> 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.RemoveThis@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: ReWrite Rules 
Back to top
Login to vote
stephan

External


Since: Jul 15, 2003
Posts: 1



(Msg. 3) Posted: Tue Jul 15, 2003 5:41 pm
Post subject: Re: ReWrite Rules [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Alex wrote:
 > Can a rewrite rule or something be used so that if
 > <a style='text-decoration: underline;' href="http://www.indigoclothing.com" target="_blank">www.indigoclothing.com</a> 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&layout=$layout"
-->

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

(http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=226784;sb=post_latest_reply;so=ASC;forum_view=forum_view_collapsed;;page=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:
<a style='text-decoration: underline;' href="http://foo.com/dynamic_looking_link.html" target="_blank">http://foo.com/dynamic_looking_link.html</a>

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:
<a style='text-decoration: underline;' href="http://foo.com/appname/somearg/anotherarg" target="_blank">http://foo.com/appname/somearg/anotherarg</a>
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 <a style='text-decoration: underline;' href="http://counter.li.org" target="_blank">http://counter.li.org</a>
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.<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ReWrite Rules 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
rewrite url to hide GET values - Hello, I would rewrite url to handle a problem I have with dynamic media files. I use a php script to retrieve media files (quicktime, real video ....) from non public directories. I access the file via media.php?m=dataxxx. It works but the..

"Method Not Allowed" when attempting to GET an exe file w/.. - Can you help me, please? Configuration : Server version: Apache/1.3.20 (Unix) System = SunOS Release = 5.8 httpd.conf contains : LoadModule rewrite_module libexec/mod_rewrite.so LoadModule proxy_module libexec/libproxy.so .... RewriteCond..
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]