Re: Vanity URL Rewrites Best Practices?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 3, 2011 at 2:25 PM, Nick Tkach <ntkach@xxxxxxxxx> wrote:
Does anyone have any pointers/suggestions on the best way to do vanity url rewrites?

For example,

 
 http://foo.com/mmh/maintenance_plan/tip?contentCategoryType=MaintenanceTip&id=%2Fwww%2Favm_webapps%2Fmmh%2Fmaintenance-tips%2Fcontent%2Fafter_blizzard.xml 

Being sent to

 
 http://foo.com/mmh/articles/authored/after-blizzard

Drupal uses rules like this:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

That is, "if there is no matching file or directory, redirect to an index.php script and pass the URL in as the parameter q".  That script then looks up the URL in a database and serves up the right content.

That is a pretty common approach.

Hope this helps,

-----Scott.


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux