Help making urls pretty with ht access

  • I’m looking to set htaccesss so that the following url


    Looks like the following


    Both '/any-section' and '/sub-section' could be anything.

    There is already the standard Perch htaccess (below) removing the .php from the end of the /any-section.php filename.

    1. # Redirect to PHP if it exists.# e.g. will display the contents of %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME}.php -f
    2. RewriteRule ^(.+)$ $1.php [L,QSA]
  • This code works for me:

    I think it will only work to the second level but it works OK at the moment.

  • drewm

    Approved the thread.