Dani

Could you look into this if you had time, probably would not take that long for you.

For the higher level URL's to get into the gallery system, I have this in my .htaccess:

RewriteEngine On

RewriteRule ^index.html index.php [L,NC]
RewriteRule ^rantgirl([0-9]+).html$ index.php?rgom=$1 [L,NC]
RewriteRule ^rgom([0-9]+)-(.*).html$ browseimages.php?c=$1 [L,NC]

I am trying to mod_rewrite the indivudual pictures for each gallery. If i had the following URL's, how could I mod_rewrite them

http://www.sportsrant.com/gallery/showimage.php?i=1399&c=46

it is based off of the i=#### and the &c=##. the I being the picture number and the C valure being the album number.

I have donated to this site before and will do it again if you can help me out (even if You cannot figure this one out :cheesy: )

Regards,
Mike
Sportsrant.com

Dani AI

Generated

Good progress — already has the higher-level rewrites working and the image rule is nearly there. For image URLs the most reliable approach is a strict, anchored pattern that only accepts digits for the two IDs, plus file/directory checks so existing assets aren’t accidentally rewritten. The rule below uses a clean, predictable URL form (/gallery/ALBUM/IMAGE.html) and rewrites internally to the gallery script.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^gallery/([0-9]{1,6})/([0-9]{1,7})\.html$ gallery/showimage.php?c=$1&i=$2 [L,QSA,NC]

Notes on why this helps: the two RewriteCond lines prevent rewrites when a real file or directory exists; the regex enforces numeric IDs and avoids accidental matches; \.html$ makes the extension explicit; QSA preserves any extra query string parameters, L stops further rule processing, and NC makes it case-insensitive. Keep this rule above any broad vBulletin catch-alls so it gets evaluated first.

Quick troubleshooting checklist: confirm mod_rewrite is enabled and the virtualhost allows .htaccess (AllowOverride All), test with a deliberate simple rule to prove .htaccess is read, inspect responses with curl -I, and check Apache error logs (use LogLevel alert rewrite:trace3 on Apache 2.4+ for detailed rewrite traces). Avoid using HTML-escaped ampersands (&) inside the .htaccess substitution — use &. If a permanent public URL change is desired, expose a 301 redirect instead of an internal rewrite.

would something like this be even close:

RewriteRule ^showimage-([1-9][0-9]*)-rgom-([1-9][0-9]*).html  showimage.php?i=$1&c=$2

acutally i think that I am getting somewhere:

RewriteRule ^image([0-9]*)-rantgirl([0-9]*).html  showimage.php?i=$1&c=$2 [L,NC]

This URL works for it, i just want to make sure that I am getting somewhere

http://www.sportsrant.com/gallery/image1453-rantgirl44.html

Dani do you see any problems with that code so far

Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.