The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End [Solved] .htaccess ‘Pretty’ URLs

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #26711

    Hi. I’m not sure where to put this, PHP Help & Troubleshooting seemed appropriate.

    I’m creating a fairly simple file uploader for some experience, and everything is working quite well. Currently I’m attempting to embed .swf files with SwfObject.

    Basically what my code does is upload the file, and then the URL becomes – 12345678 being the file name of course. Then, view.php grabs the ID with GET, and echoes it out as the URL to embed into the page.
    This works perfectly!

    However, what I think would add a really nice touch is prettying up the URL a bit. For instance:


    I messed around with some stuff and ended up with this:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteRule ^view/(d+)*$ ./view.php?id=$1

    Now, if I go to it looks absolutely fine, and if I view source it’s identical to my ?id version.
    Of course this is where my troubles reside. Everything should work fine, the path to the file is fine, the swf dimensions are fine, everything should work.
    For some reason, it won’t show the .swf file. The alternate content appears instead (Please install your flash player etc) and I’m r8 lost m8

    Any clues? Sorry if this is a bit vague, more code can be provided.


    A good thing to do is to start relative paths with a slash.

    ie. in your 12345678-file where it says src="path/to/myThing.swf" src="/path/to/myThing.swf" that way it’ll start "counting" from the root of your site and not from the non-existing /view. Or wherever you happen to be.


    Ah, thanks for reminding me about that. It sort of slipped my mind, I just realized that the path to my javascript files wasn’t correctly set, hehe.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.