Forum Moderators: phranque

Message Too Old, No Replies

Can this be done? mod_rewrite

Rewriting dynamic URLs

         

Hop_Hop

10:08 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



I have a link like :
[domain.com...]
and i want this to be Rewritten into:
[domain.com...]

Now i get one big problem . The links/pictures/graphics of the site are in this format: <a href="index.php..." <img src=/images/header.gif .... etc. When i make the Rewriterule to transform that link above all my site content transforms in this : <a href=/moreinfo/20/index.php..." and <img scr=/moreinfo/20/images.gif .... etc. This means the entire site is messed up.
Can you guys help me with a piece of .htaccess Rewriterules? i must underline that i`m using httpd.conf not .htaccess.

Thank you!

Hop_Hop

10:14 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



It practicaly acts like i had a directory "moreinfo" and another directory "20"

jdMorgan

11:24 pm on Jul 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hop_Hop,

Welcome to WebmasterWorld!

The process works the other way. Change your script to output the 'friendly' URLS, then use mod_rewrite to convert them back into the form needed to invoke your script. When you do so, it's easy to exclude images, css, and external JS files from being rewrtten by using the RewriteCond directive.

See this recent thread [webmasterworld.com].

Jim

Hop_Hop

11:29 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



ok, i did not quite undestood much from the thread you directed me to . i`m kind of learning from examples guy.

so. let`s suppose all the links from my site are in the format:
[site.com...] , ok?

Can you teach me what`s next from here?

jdMorgan

2:12 am on Jul 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check out the documentation cited in our charter [webmasterworld.com]; Use it to line-by-line analyze and understand the code examples posted in related threads turned up by that search in the other thread I linked to. We can help you learn, but we can't write the code for you here (see also the charter text) -- AND doing so would not be doing you a favor anyway, because you don't want to put configuration code on your server that you don't understand. It's going to have big effects on your site, and if some of those effects are bad, you certainly don't want to be stuck here waiting hours for an answer from some kind stranger while your search engine rankings burn and your server smokes... :o

Jim

jdMorgan

2:37 am on Jul 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Aha! - Found it...

This thread from member jd01 may prove useful: What you don't know you need to know... [webmasterworld.com]

Jim