PDA

View Full Version : apache rewrite with htaccess and swfobject?



daheroes
August 29th, 2007, 05:10 AM
Hi all,

I'm trying to use .htaccess to rewrite urls, much like in the tutorial on this site (here (http://www.kirupa.com/developer/php/clean_url_pg1.htm))

I'm using the rewrite to change the start page of an xml file, which is loaded by flash.

On the page itself, I'm using SWFObject (from deconcept, here (http://blog.deconcept.com/swfobject/)). However, whenever I try to access the page with multiple vars (like mysite.com/firstvar/secondvar ), the page doesn't display the way it should.

Normally, the swfObject will replace the content of one div with a flash object. However, with this rewrite stuff, it doesn't attempt to replace the content, and instead just displays it as text.

It works fine with just one variable, like this: http://www.mysite.com/firstvar
But it doesn't work if I add a slash at the end: http://www.mysite.com/firstvar/

Right now this is my .htaccess file.

(I'm thinking the problem is in here, though I don't know.)



# this is the initialization
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# these are the rewrite conditions
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# and finally, the rewrite rules
RewriteRule ^([a-zA-Z0-9\-]+)/?$ /index2.php?artist=$1 [L,QSA]
#RewriteRule ^([a-zA-Z0-9\-]+)/([a-zA-Z0-9\-]+)/?$ /index2.php?artist=$1&project=$2 [L,QSA]

ErrorDocument 404 http://www.mysite.com/errordocs/404.html
ErrorDocument 403 http://www.mysite.com/errordocs/403.html

Options -Indexes

RewriteCond %{REQUEST_FILENAME} .*jpg$|.*swf$|.*png$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !mysite\.com [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule .*\.(jpe?g|png)$ /errordocs/ring.jpe [L]


I'm afraid I don't understand .htaccess well enough to see if there's an issue there.

Can anyone help me out?

daheroes
August 29th, 2007, 06:56 AM
Nevermind, I think I figured it out.