CAP by htaccess

  • There are these redirective rules:

    RewriteRule index.html /index.php?act=main [QSA,L]
    RewriteRule main/?$ /index.php?act=main [QSA,L]
    RewriteRule search/?$ /index.php?act=search [QSA,L]
    RewriteRule main/?index.html?$ /index.php?act=main [QSA,L]
    RewriteRule search/?index.html?$ /index.php?act=search [QSA,L]

    RewriteRule site-map/?$ /index.php?act=site-map [QSA,L]
    RewriteRule site-map/?index.html?$ /index.php?act=site-map [QSA,L]
    RewriteRule follow/?$ /index.php?act=follow [QSA,L]
    RewriteRule follow/?index.html?$ /index.php?act=follow [QSA,L]
    RewriteRule events/?$ /index.php?act=events [QSA,L]
    RewriteRule events/?index.html?$ /index.php?act=events [QSA,L]
    RewriteRule contact/?$ /index.php?act=contact [QSA,L]
    RewriteRule contact/?index.html?$ /index.php?act=contact [QSA,L]

    RewriteRule gallery/?$ /index.php?act=gallery [QSA,L]
    RewriteRule gallery/?index.html?$ /index.php?act=gallery [QSA,L]
    RewriteRule gallery/album/?([0-9]+)?-?([A-Za-z0-9_-]+)?/?$ /index.php?act=gallery&module=album&id=$1&cpu=$2 [QSA,L]
    RewriteRule gallery/album/?([0-9]+)?-?([A-Za-z0-9_-]+)?/?index.html?$ /index.php?act=gallery&module=album&id=$1&cpu=$2 [QSA,L]

    RewriteRule page/?$ /index.php?act=page [QSA,L]
    RewriteRule page/?index.html?$ /index.php?act=page [QSA,L]
    RewriteRule page/?([0-9]+)?-?([A-Za-z0-9_-]+)?/?$ /index.php?act=page&id=$1&cpu=$2 [QSA,L]
    RewriteRule page/?([0-9]+)?-?([A-Za-z0-9_-]+)?/?index.html?$ /index.php?act=page&id=$1&cpu=$2 [QSA,L]

    RewriteRule t/?([A-Za-z0-9_-]+)?/?$ /index.php?act=teacher&cpu=$1 [QSA,L]
    RewriteRule t/?([A-Za-z0-9_-]+)?/?index.html?$ /index.php?act=teacher&cpu=$1 [QSA,L]
    RewriteRule t/?([A-Za-z0-9_-]+)?/?([0-9]+)?-?([A-Za-z0-9_-]+)?/?$ /index.php?act=teacher&cpu=$1&id_p=$2&cpu_p=$3 [QSA,L]
    RewriteRule t/?([A-Za-z0-9_-]+)?/?([0-9]+)?-?([A-Za-z0-9_-]+)?/?index.html?$ /index.php?act=teacher&cpu=$1&id_p=$2&cpu_p=$3 [QSA,L]

    RewriteRule news/?$ /index.php?act=news [QSA,L]
    RewriteRule news/?index.html?$ /index.php?act=news [QSA,L]
    RewriteRule news/?([0-9]+)?-?([A-Za-z0-9_-]+)?/?$ /index.php?act=news&module=art&id=$1&cpu=$2 [QSA,L]
    RewriteRule news/?([0-9]+)?-?([A-Za-z0-9_-]+)?/?index.html?$ /index.php?act=news&module=art&id=$1&cpu=$2 [QSA,L]

    How can they be redirected for /search, /search/ and /search/index.html to /index.php?act=search?
    And of course it is for all the others.

    Now that /search/index.html is completed, redirected to /index.php?act=main (also all other rules)

  • The mistake is in line one. This rule will work if it's in %{REQUEST_URI} anywhere We'll meet the line. index.html♪ As it stands first, it will most often work. To redirect only the address. /index.htmlthe rule shall be recorded as follows:

    RewriteRule ^index.html$ /index.php?act=main [QSA,L]

    A similar kind of error in all other lines. If you need to %{REQUEST_URI} Started with a line, at the beginning, a symbol must be placed in front of this line. ^:

    RewriteRule ^main/?$ /index.php?act=main [QSA,L]

    In general, the condition of redirection is (almost)

    Another error in the shape of the species

    RewriteRule main/?index.html?$ /index.php?act=main [QSA,L]

    This rule doesn't work just for the address. main/index.htmlbut also for mainindex.html♪ Signing the question in regular terms means that a symbol can be met with zero or once. To fix it, you have to write it down:

    RewriteRule ^main/index.html?$ /index.php?act=main [QSA,L]

Log in to reply

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2