I am trying to create a random image/link generator. The anchor tags are effectively written in the PHP code as "link.php?action=detail&id={LINKID}".
The mod_rewrite SHOULD point them to "{DIRURL}/wesleychapelbusinesses/{LINKCATNAME}/{LINKTITLE}/{LINKID}.html" (This is the way WSN Links functions when just browsing).
But when the page loads, the links are actually rewritten to "{DIRURL}/wesleychapelbusinesses/detail/{LINKID}". (This URL strangely works also, but doesn't seem to follow the conditionals in my Details template...)
I think there is a conflict in my .HTACCESS file, but I don't know what to look for.
I see a link to www.gowesleychapel.com/dire...tomotive/sponsor_2/33.html which when clicked shows that url in my browser, no forwarding. I thought that was what you wanted so I guess I'm not understanding what you're trying to do, unless you fixed it already.
I should have specified which anchor tags had the problem.
On the home page: http://www.gowesleychapel.com/directory/index.php The "Affordable Advertising" blocks on the top right. Notice the URL is "http://www.gowesleychapel.com/directory/wesleychapelbusinesses/detail/33"
The URL format you mentioned is the correct one. They should look like: "http://www.gowesleychapel.com/directory/wesleychapelbusinesses/Automotive/sponsor_2/33.html" Everywhere else they do look like this.
Here's the PHP I'm running in the Main Index template: (There is a function elsewhere which scans the directory for pictures & randomizes the images.)
If you use PHP like that it executes after the modrewrite alterations, so you need to use the format you want it to appear in and not expect a translation. If you create a link object $l = new onelink('id', $file); then $l->rewriteurl(); gives the full url.
0/5
1
2
3
4
5
This thread is closed, so you cannot post a reply.
Comments on problems with mod_rewrite
Nothing is impossible...
Usergroup: Customer
Joined: Aug 07, 2006
Location: Tampa, Florida
Total Topics: 36
Total Comments: 91
I am trying to create a random image/link generator.
The anchor tags are effectively written in the PHP code as "link.php?action=detail&id={LINKID}".
The mod_rewrite SHOULD point them to "{DIRURL}/wesleychapelbusinesses/{LINKCATNAME}/{LINKTITLE}/{LINKID}.html"
(This is the way WSN Links functions when just browsing).
But when the page loads, the links are actually rewritten to "{DIRURL}/wesleychapelbusinesses/detail/{LINKID}".
(This URL strangely works also, but doesn't seem to follow the conditionals in my Details template...)
I think there is a conflict in my .HTACCESS file, but I don't know what to look for.
Any ideas?
Here's the content of my .HTACCESS file:
Options +FollowSymlinks
RewriteEngine on
RewriteBase /directory/
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [R]
RewriteRule ^admin$ admin/index.php
RewriteRule ^admin/$ admin/index.php
RewriteRule ^wesleychapelbusinesses/([a-z]+)/([0-9]+)/?$ link.php?action=detail&id=$2
RewriteRule ^wesleychapelbusinesses/([0-9]+)/?$ link.php?id=$1
RewriteRule ^thread/([0-9]+)/?$ comments.php?id=$1
RewriteRule ^thread/([0-9]+)/([0-9]+)/?$ comments.php?id=$1&page=$2
RewriteRule ^([0-9]+)/?$ index.php?action=displaycat&catid=$1
RewriteRule ^([0-9]+)/([0-9]+)/?$ index.php?action=displaycat&catid=$1&page=$2
RewriteRule ^([-_/\+A-Za-z0-9]+)$ index.php?action=displaycat&catname=$1
RewriteRule ^wesleychapelbusinesses/([-_/\+A-Za-z0-9]+)/([0-9]+).html$ link.php?action=detail&id=$2
RewriteRule ^/([-_/\+A-Za-z0-9]+)/([0-9]+).html$ link.php?action=detail&id=$2
RewriteRule ^Local_Businesses_Sitemap.html$ sitemap.php
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I see a link to www.gowesleychapel.com/dire...tomotive/sponsor_2/33.html which when clicked shows that url in my browser, no forwarding. I thought that was what you wanted so I guess I'm not understanding what you're trying to do, unless you fixed it already.
Nothing is impossible...
Usergroup: Customer
Joined: Aug 07, 2006
Location: Tampa, Florida
Total Topics: 36
Total Comments: 91
I should have specified which anchor tags had the problem.
On the home page: http://www.gowesleychapel.com/directory/index.php
The "Affordable Advertising" blocks on the top right.
Notice the URL is "http://www.gowesleychapel.com/directory/wesleychapelbusinesses/detail/33"
The URL format you mentioned is the correct one. They should look like:
"http://www.gowesleychapel.com/directory/wesleychapelbusinesses/Automotive/sponsor_2/33.html"
Everywhere else they do look like this.
Here's the PHP I'm running in the Main Index template:
(There is a function elsewhere which scans the directory for pictures & randomizes the images.)
<?php
echo '<a href="link.php?action=detail&id='.$file.'">
<img src="{DIRURL}/homepageads/' . $file . '.gif" border="0"></a><br><br>'
echo '<a href="link.php?action=detail&id='.$file1.'">
<img src="{DIRURL}/homepageads/' . $file1 . '.gif" border="0"></a><br><br>'
echo '<a href="link.php?action=detail&id='.$file2.'">
<img src="{DIRURL}/homepageads/' . $file2 . '.gif" border="0"></a><br><br>'
echo '<a href="link.php?action=detail&id='.$file3.'">
<img src="{DIRURL}/homepageads/' . $file3 . '.gif" border="0"></a><br><br>'
?>
As you can see, the script uses the filename of the GIF to construct the anchor tag. The pictures are named 33.gif, 108.gif, etc.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
If you use PHP like that it executes after the modrewrite alterations, so you need to use the format you want it to appear in and not expect a translation. If you create a link object $l = new onelink('id', $file); then $l->rewriteurl(); gives the full url.