• Resolved drzax

    (@drzax)


    I’ve just moved to a host which actually has mod_rewrite. I really want to use this because it obviously gives a lot more flexibility.

    Until now my permalink structure has had /index.php/ at the start (so I could actually use nice permalinks).

    I REALLY don’t want to break all the links I have accumulated over time to my site. Is there a way I can maintain /index.php/ in my permalink structure and use mod_rewrite. Or even better use a new permalink structure without /index.php/ but not break any links?

    Cheers,
    S.

Viewing 1 replies (of 1 total)
  • Thread Starter drzax

    (@drzax)

    Just in case anyone finds this topic in the future I’ll post up how I solved it.

    It’s actually very easy, but due to my lack of .htaccess / mod_rewrite knowledge it took a while.

    You just need to duplicate a few lines in your .htaccess file so that it recognises urls with index.php in them as well. For example, as well as the usual line:


    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$ /drzax/index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA,L]

    Add a second line that says:


    RewriteRule ^index\.php/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$ /drzax/index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA,L]

    I suspect there is a better/easier way to do this all in one rule by specifying that the index.php part is optional but my .htaccess regular expression knowledge is still fairly light on.

    S.

Viewing 1 replies (of 1 total)
  • The topic ‘Keeping index.php in the permalink structure and using mod_rewrite’ is closed to new replies.