View Full Version : Another mod_rewrite issue

03-28-2010, 09:02 AM
http://www.explicitgamer.com/dev/article/final-fantasy-xiii-review-2 (rewritten URL)
http://www.explicitgamer.com/dev/article.php?p=4668 (actual URL)

Mod Rewrite Rules:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /dev/article/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /dev/article.php [L]

I use the following code in article.php to figure out what article is being pulled:

$uri = str_replace("/", "", substr($_SERVER["REQUEST_URI"], 13));
$xg_article = getAllArticleInfoByName($uri);

And if it matters, pages are cached, but that shouldn't matter because both the actual and rewritten urls are cached (separately).

If you goto the actual url the share tools (digg, reddit, facebook, twitter etc) work fine.

If you use the rewritten url none of them work. For some reason they aren't able to connect to the page properly to grab info (or verify the page even exists) through the rewritten url.

I'm not really sure what is wrong, but it is kind of irritating that I can't figure out a solution. I'm not too familiar with mod_rewrite so I was hoping someone could help me fix it or direct me to some resources that might be able to help me out.

Thanx in advance,

To expand on the problem a bit:

The problem is that the rewritten URL doesn't work outside of the website. Like if you goto the rewritten URL itself, it works fine, but if you try to submit the URL to something like DIGG, Facebook, or Reddit, their scripts can't find the url so the webpage can't be submitted.


If you go there, and type in http://www.explicitgamer.com/dev/article/final-fantasy-xiii-review-2 as the article url, it gives an error:

This link does not appear to be a working link. Please check the URL and try again.

The only thing I can think of is that the mod_rewrite that I currently have setup is actually doing a redirect, not a rewrite. That is the only reason that I can think of that this would be happening.