Welcome to WebmasterWorld Guest from 54.166.178.177

Forum Moderators: phranque

Message Too Old, No Replies

Does mod_rewrite automatically change URLs?

Should i be hardcoding rewritten URLs?

     
8:49 pm on Aug 19, 2003 (gmt 0)

10+ Year Member



hey guys im trying to make a dynamic URL static and ive got it to the point where i can goto make the following URL:

domain.com/?varname=var

translate into this:
domain.com/var_name/var

My question is now that i have that finished, do i have to Hard code all links to be domain.com/var_name/var/ instead of the dynamic URL, or does mod_rewrite do this automatically?

Its currently not doing it automatically, so im not sure what is happening.

9:00 pm on Aug 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the whole thing is about hiding the variables from the browser address line and the SE spiders, then you would only use this for your scripts:

1) domain.com/?varname=var

- and use this in links and everywhere else:

2) domain.com/var_name/var

mod_rewrite can make sure that the server "sees" no 1 when no 2 is entered in the browser, so that when asking for no 2, a visitor will get no 1 delivered (or the other way round).

I think you may have done it the other way round, so that no. 1 entered in the address line will be no. 2 on the server, and then your scripts will not work, but it's easy to fix, just reverse it :)

/claus

12:38 am on Aug 20, 2003 (gmt 0)

10+ Year Member



claus, thank you for responding, but im a little confused.

You are absolutely, right. I want SEs to be able to spider my links, i run a link site (almos like dmoz, but on a super small scale and only targeting a specfic type of site) but each catagory of links a diff variable call to a php script.

Are you saying that i have to Hard code all static links into my scripts?

I was under the impressions that by setting mod_rewrite to rewrite the URL, links on the pages are automatically changed from the dynamic URL that used to be displayed, to a static URL when viewed/spidered.

1:13 am on Aug 20, 2003 (gmt 0)

10+ Year Member



Are you saying that i have to Hard code all static links into my scripts?

Yes.

I was under the impressions that by setting mod_rewrite to rewrite the URL, links on the pages are automatically changed from the dynamic URL that used to be displayed, to a static URL when viewed/spidered.

You have it backwards. The mod_rewrite takes a static looking url, peels off the variables, and converts it back to a dynamic url before the script executes it. So, you need to hardcode the static links not the dynamic ones.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month