CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   Easy htaccess condition (http://www.codingforums.com/showthread.php?t=286928)

withoutnick 02-02-2013 05:24 PM

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.

withoutnick 02-02-2013 06:54 PM

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?


All times are GMT +1. The time now is 02:54 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.