Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    24
    Thanks
    1
    Thanked 1 Time in 1 Post

    Easy htaccess condition

    Hello, I am total begginer here. I would be grateful if you could help me.

    I have this rewrite condition + rewrite.

    RewriteCond %{REQUEST_URI} ^([^/]*).html$ [NC]
    RewriteRule ^(.*).html$ index.php?page=$1 [L,QSA]

    When i test it, i get page not found. Online regex tester, matches the result without no error.

    The htaccess file is one level deeper than home dir: the address would be http://www.mydomain.com/regex_directory/

    Thank you.

  • #2
    New Coder
    Join Date
    Apr 2011
    Posts
    24
    Thanks
    1
    Thanked 1 Time in 1 Post
    I did a modification to regex

    Code:
    RewriteCond %{REQUEST_URI} .([^/])*.html$ [NC]
    RewriteRule ^(.*).html$		index.php?page=$1 [L,QSA]
    Now it matches the request: mydomain.com/directory/index.html

    But as well it matches and mydomain.com/directory/inde/x.html

    $_GET variable page than is shown as inde/x?

    What is wrong with my regex?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •