Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   General Business Knowledge (http://www.greenguysboard.com/board/forumdisplay.php?f=10)
-   -   Recips & RegEx help please (http://www.greenguysboard.com/board/showthread.php?t=51864)

A.J. Angel 2009-03-10 10:12 PM

Recips & RegEx help please
 
I'm trying to set up reciprocal links but have no knowledge with RegEx (regular expressions). I'm not even sure it is possible to do this but before giving up, I thought I'd ask around.

Anyway, this is the base code for the reciprocal link:

Code:


Now, I would like to know, if it is indeed possible, what is the RegEx code to use so that the "exquisiteangelz.gif" file could be located in any folder, not necessarily in the same folder as the gallery or free site (eg. /images/recips/exquisiteangelz.gif).

Any help would be appreciated. Thank you! :)

cd34 2009-03-10 10:49 PM

To prevent loops, you want to name the recip to something different than exquisiteangelz.gif and use something like:

Code:

RewriteEngine on
RewriteRule .*exquisiteangelz.gif$ /images/recips/exquisiteangelzrecip.gif [L]

you don't want to name it newexquisiteangelz.gif because that would match the regexp and cause a redirect loop.

Keep in mind, anywhere else on your site that you use RewriteEngine on, you will need to use RewriteOptions inherit or add the rule to that .htaccess as well.

A.J. Angel 2009-03-10 11:00 PM

Quote:

Originally Posted by cd34 (Post 443986)
To prevent loops, you want to name the recip to something different than exquisiteangelz.gif and use something like:

Code:

RewriteEngine on
RewriteRule .*exquisiteangelz.gif$ /images/recips/exquisiteangelzrecip.gif [L]

you don't want to name it newexquisiteangelz.gif because that would match the regexp and cause a redirect loop.

Keep in mind, anywhere else on your site that you use RewriteEngine on, you will need to use RewriteOptions inherit or add the rule to that .htaccess as well.

I'm sorry but I'm not sure to understand you. What would be matching the RegEx to cause a redirect loop?

This is actually not for my site but for submitters to link back to my site with the appropriate reciprocal link. |confused|

cd34 2009-03-10 11:25 PM

Code:

RewriteRule .*exquisiteangelz.gif$ /images/recips/exquisiteangelzrecip.gif [L]
This rule will match anything that ends with exquisiteangelz.gif As a consequence, it will also match /images/recips/newexquisiteangelz.gif. So, if you were going to do it, you should rename your recip as exquisiteangelzrecip.gif which wouldn't match the rewrite rule.

A.J. Angel 2009-03-10 11:34 PM

Oh ok, thanks for the suggestion!

Do you happen to know the RegEx code that would suit my case at the same time?

cd34 2009-03-10 11:50 PM

If I understand what you're asking:

Code:

RewriteEngine on
RewriteRule .*exquisiteangelz.gif$ /images/recips/exquisiteangelzrecip.gif [L]

is what you want.

Store your recip in /images/recips/ as exquisiteangelzrecip.gif

and link to it as

A.J. Angel 2009-03-11 12:29 AM

LOL! No, you completely misunderstood me. What I want is to install the code in my first post with RegEx so that submitters can use that code to link back to my site on their galleries and free sites. ;)

Beaver Bob 2009-03-11 12:47 AM

why do you need to use regular expressions to make a recip link?

cd34 2009-03-11 02:05 AM

You want remote sites to be able to hotlink your recip?

Code:


And in the /images/recips/ directory, .htaccess that contains

Code:

RewriteEngine off

A.J. Angel 2009-03-11 03:53 PM

Okay, thanks guys for your help!

I have finally found the issue and got it worked. :D


All times are GMT -4. The time now is 10:57 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc