Announcement

Collapse
No announcement yet.

Quick .htaccess question (MOD_REWRITE)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quick .htaccess question (MOD_REWRITE)

    Im in the middle of making some blog software when i noticed a error on the blog the posts are organised as domain.com/category/post and only one category is allowed but i tested domain.com/category/category/category/post and it brings up the same as domain.com/category/post i have written a quick PHP hack for it but im wondering if the error can be fixed in the .htaccess file itself.

    The .htaccess that im using:

    Code:
    RewriteRule ([a-zA-Z-0-9_]+)/([a-zA-Z-0-9_]+)/?$ post.php?category=$1&post=$2 [L,QSA]

  • #2
    Re:

    Here i am going to enlisting quick .htacess rewrite code for mod_write and i wish that it could help you anyhow for the redirection.

    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^(/\d{category1}/\d{category2}/)([^/]+)(/.*)$
    RewriteCond %2 ^category1|category2|category3|category5$
    RewriteRule ^(.*)$ http://other.example.com$1 [redirect=permanent,last]

    Comment

    Working...
    X