Forums

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

Home Forums Other [Solved] mod_rewrite Help

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #30531
    Voltron
    Member

    Hi, is anyone here any good with mod_rewrite ? I’ve built the following for my .htaccess


    Options +FollowSymLinks
    Options +Indexes
    RewriteEngine On

    RewriteBase /
    RewriteRule ^review/([0-9]+)/(.*)$ review.php?id=$1
    RewriteRule ^article/([0-9]+)/(.*)$ article.php?id=$1

    So I can link to reviews using, for example, http://unstoppablevoltron.com/review/2/avatar where the /2/ will then be translated to unstoppablevoltron.com/review.php?id=2 (what I currently use) , which works except the server now looks for everything to be in a /review/ subfolder, so none of my links or images work (I use relative linking throughout).

    Is there an easy fix for this? Maybe make a /review/ and /article/ folder where request is redirected back into the root? If so, what would be the best .htaccess setup for that?

    I’ve got the rewrite disabled now because it messes things up so badly.

    edit:

    I’ve tried making the /review/ folder as above with


    RedirectMatch ^http://www.unstoppablevoltron.com/review/.+$ http://www..unstoppablevoltron.com/.+$

    and it seems to kick too early, and stops the previous .htaccess rewrite from working, so it doesn’t appear that’s a go.

    edit:

    Aha! Fixed it with a base URL call in the article/review PHP files. Knew it would be something ridiculously simple :)

Viewing 1 post (of 1 total)
  • The forum ‘Other’ is closed to new topics and replies.