Jump to content

Recommended Posts

hi guys, i was wondering how would i go about (basically i have a rewrite rule which turns kidblog/disclaimer into kidblog/index.php?section=disclaimer

 

so if someone types in kidblog/DisClaimEr

 

it would translate that into kidblog/index.php?section=DisClaimEr, so how owuld i make it so even with capitals it still translates it into lowercase, i dont want a redirect or anything like that. 

Link to comment
https://forums.phpfreaks.com/topic/144750-htaccess/
Share on other sites

Just ad * NC * to the condition...

 

kidblog/index.php?section=$1 [L,NC]

 

With A-Za-z as the regex surely the [NC] part is unneseccary?

 

Ya, but using a regex makes the point of the rewrite kind of silly, if you're only wanting to rewrite KiDlOg/DisClaimEr, then NC is the best way because what stops someone from doing KiDlOg/monkeys, you lose the restriction on the rewite because your allowing for anything after * / *. Plus it still wont match because kidlog is not in lower case!

Link to comment
https://forums.phpfreaks.com/topic/144750-htaccess/#findComment-759574
Share on other sites

Ya, but using a regex makes the point of the rewrite kind of silly, if you're only wanting to rewrite KiDlOg/DisClaimEr, then NC is the best way because what stops someone from doing KiDlOg/monkeys, you lose the restriction on the rewite because your allowing for anything after * / *. Plus it still wont match because kidlog is not in lower case!

 

I see what you're saying, but when I use rewrite on sites it's usually for everypage (maybe not in this case) so I use a regular expression that will allow letters and dashes or whatever's needed. Then the $_GET value is checked in the script as it should be. If it's wrong they go to the home page so people misspelling etc don't get an error but a redirect to the home page of the site.

Link to comment
https://forums.phpfreaks.com/topic/144750-htaccess/#findComment-759577
Share on other sites

cheers guys, i use the regex because i only want letters there,

 

the ht access file is in the kidblog directory so the redirecting wont work anywhere else anyway,

 

and i know im able to do it through php, i was jsut wondering is there anyway to do it jsut through htaccess?

Link to comment
https://forums.phpfreaks.com/topic/144750-htaccess/#findComment-759594
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.