peuge Posted June 27, 2008 Share Posted June 27, 2008 Ok so I got this url when you enter the page www.yoursite.com/index.php now I have a menu with options such as Contact - Gallery - etc... This menu sends a variable to index.php such that the address becomes www.yoursite.com/index.php?choice=1 choice 1 is the gallery So firstly I want to make that www.yoursite.com/gallery Secondly in the gallery I have thumbs.php and categories.php in a table with a large view of the picture clicked in the middle. I need to send the variable when user clicks on a thumb to index.php or it just opens up gallery. So when I click on a thumb the url reads http://www.yoursite.com/index.php?pic=IMAGENAME&category=landscape/&&choice=1 where pic is the image name, category the category and choice keeps index in gallery. I need the url to just say the category such as: www.yoursite.com/landscape Is there a way to do this in .htaccess? I have been googling but cannot seem to figure it out? Thanks Quote Link to comment Share on other sites More sharing options...
thebadbad Posted June 27, 2008 Share Posted June 27, 2008 It's not intuitive to access a specific gallery category that way. And you also need to include the IMAGENAME somewhere. My advice is to access them like this: gallery - mysite.com/gallery/ gallery category - mysite.com/gallery/landscape/ gallery image inside category - mysite.com/gallery/landscape/imagename/ Something like this below would work for those examples. Just put the .htaccess file in your website root: .htaccess RewriteEngine on RewriteRule ^gallery/$ index.php?choice=1 RewriteRule ^gallery/([a-zA-Z0-9]+)/$ index.php?choice=1$category=$1 RewriteRule ^gallery/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/$ index.php?choice=1$category=$1&pic=$2 Should get you started. If the category name and image name can contain anything other than alphanumeric characters, just alter [a-zA-Z0-9] accordingly. Quote Link to comment Share on other sites More sharing options...
peuge Posted June 27, 2008 Author Share Posted June 27, 2008 Cool, did that... now when I go to mysite.com/galary in opens gallery.php I need it to open index.php..... Is there a good htaccess tutorial you can recommend so I can try figure this all out myself? Quote Link to comment Share on other sites More sharing options...
peuge Posted June 27, 2008 Author Share Posted June 27, 2008 I will try to explain further: I have 1) Gallery.php - include thumbs.php and categories.php all requests from these are sent to index.php 2) index.php - includes menu.php, gallery.php, home.php etc all requests from menu.php are sent to index.php The reason I sent them to index.php is because I need the page to stay the same and only the relevant data to load in a table I created in index.php No with all these pointing to index.php my url is always /index.php?SOMETHING.HERE example: /index.php?pic=images/landscape/big/como%2040%20x%2050%20(Large).jpg&category=landscape/&&choice=1 So now my question is with that information can I rewrite my urls to just be images/landscape/imgname? or not? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.