Jump to content

mod_rewrite help


cmgmyr

Recommended Posts

I have a site that has dynamic kiosk stores and I can't seem to get everything to work how I want it to.

 

1. I need url.com/kiosk_name going to url.com/store/index.php?kiosk=kiosk_name (which I have that so far).

2. I need url.com/kiosk_name/products.php going to url.com/store/products.php?kiosk=kiosk_name

3. This also needs to handle a query sting...url.com/kiosk_name/products.php?product=1 going to url.com/store/products.php?kiosk=kiosk_name&product=1

 

Here is what I have so far:

RewriteEngine  on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-F
RewriteRule ^([^/\.]+)/([^/\.]+)?$ $2?kiosk=$1 
RewriteRule ^([^/\.]+)/?$ store/index.php?kiosk=$1 [L]

 

I know I'm doing something wrong and I'm sure some other things need to be added. What should this be?

 

Thanks,

-Chris

Link to comment
https://forums.phpfreaks.com/topic/80654-mod_rewrite-help/
Share on other sites

I altered the code a little bit, here is what I have now:

RewriteEngine  on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-F
RewriteRule ^([^/\.]+)/?$ store/index.php?kiosk=$1 [L,PT] 
RewriteRule ^([^/]*)/([^/]*)$ store/$2?kiosk=$1 [QSA,L,PT] 

 

Now, the virtual directories work 100%, but when I go to the root of the site, or any of the files in the root the CSS and the images do not come up. How can I adjust this code so that it doesn't effect the root files?

 

Thanks,

-Chris

Link to comment
https://forums.phpfreaks.com/topic/80654-mod_rewrite-help/#findComment-409752
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.