Jump to content

Help with rewrite and php links plz


The14thGOD

Recommended Posts

This is my first attempt at getting mod_rewrite to work so sorry for the noob questions, i have several links for regular expressions etc and im comming up with blanks hah.

 

anyways, i have it to the point where it rewrites the url but if an invalid url is put in it's not redirecting to the right file:

 

RewriteEngine On
RewriteRule ^gallery/category/([a-z]+)/ gallery.php?category=$1
RewriteRule ^gallery/category$ ../../../index.php

 

I think it ignores the ../ cause it's still going to the same page if they were not there.

 

The second issue I am having is I want to make the page so it's more dynamic, meaning depending on the variables in the URL i dont have to go to the page and add "../../../...." to each link. How do I make these links relative off of the rewrite and not the visible URL?

IE:

<?php $hash["$row[sub_category]"][]= "<a href=\"../../../image_details.php?id=$row[id]\"><img class=\"galleryimg\" src=\"../../../$row[thumbnail]\" $dims alt=\"$row[title] thumbnail\" title=\"$row[title]\" /></a> \n";?>

or

<link rel="stylesheet" type="text/css" href="../../../css/styles.css" />

 

Thanks for any and all help, again sorry for the probably easy questions

 

Jusitn

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.