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
https://forums.phpfreaks.com/topic/163423-help-with-rewrite-and-php-links-plz/
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.