Forum Moderators: phranque

Message Too Old, No Replies

Another mod_rewrite question...

This looks like a GREAT Forum that can Help me!

         

TheSaint

6:24 pm on Jan 23, 2004 (gmt 0)



Hello,

This looks like a GREAT Forum that can help me with my problem.

I am a bit of a novice when it comes to apache, but I have a problem that I need to fix ASAP if you can help and I believe the mod_rewrite is the solution.

If a person goes to wwWebmasterWorldebsite.com/1234 I would like the 1234 to be ignored as a subfolder, but to remain as something I can pull from the domain and use as a PHP variable. So it would actually be wwWebmasterWorldebsite.com/1234/index.php.

I would then code that variable into any links on that page, so for example if a person clicked on a link to a seperate folder on the same domain, it would read wwWebmasterWorldebsite.com/1234/newfolder/newpage.php and I would have the ability to pull the 1234 from that page as well and use it on any links on that page.

So if you or anyone else might have some insight for me on this I would appreciate any help I can find. I have been reading several sites and they tend to talk around what I am looking for and without a good understanding of apache, it is a little difficult for me to figure this all out.

Thanks again,

TheSaint

P.S. I have also read where I can either apply this mod_rewrite to httpd.conf and effect all of the virtual hosts on the server, or to create a .htaccess file and put the mod_rewrite there to only effect that directory (virtual domain). So the question there is...would I need to create a seperate .htaccess file for each folder in that directory, or would it apply to all subdirectories if I put it in the main directory? Sorry if that does not seem clear...if not, let me know and I will explain further.

jdMorgan

9:49 am on Jan 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The Saint,

Welcome to WebmasterWorld [webmasterworld.com]!

For a ton of information on rewriting static-looking links to dynamic links for use with scripts, try this site search [google.com]. Some of the threads concern rewriting dynamic to static links, but you can sort them out easily - Note that the terminology is used a little loosely, and some posters get it backwards in their title, so read the first post in each thread, not just the title.

---

You can set up an .htaccess file to affect the directory in which it resides and all subdirectories, or you can put a separate .htaccess file in each directory -- your choice.

Jim