Friday, 15 February 2013

regex - cloud 7 php url rewriting, with htaccess have tried every single thing, i have not tried committing suicide -


This is my case

im is not good in any way with regexp, Avoid the kind of illness I have gone through every result on Google, now goodness "Im on searching for suicide and to die quickly" Please do I really need your help, remove the extension and query me String again

Such a www.example.com/story.php?pcord=$1 - & gt; Like www.example.com/story/%1

Please see when I mean % 1 I do not like PCOs to reorganize on the URL < / P>

For example, I should www.example.com/story.php?pcord=4849AAS84 should look something like

www.example.com Here is the code I tried to use but it does not work at all, only removes the extension

  Option + Follow-up Link - Redistrite to Multi View Turn Zine on to revertabase ## wrap .php extension snippet # rewrite / dir / foo at /dir/foo.php Cond% {THE_REQUEST} ^ [AZ] {3,} \ s ([^ .] +) \. Php [NC] rewrite rule ^% 1 [R, L] # Internally forward / DAY / EFU / DIREES / F.Php RewriteCond% {REQUEST_FILENAME}! -d RevertCand% {DOCUMENT_ROOT} / $ 1.php -f Rewrite Rules ^ (. *?) /? $$ 1.php [L]    

.htaccess < / Code>

We are capturing here the value of the query string as % 1 , then we will recieve a relative URL Which starts with story.php , which is done in a folder called story by our capturing string, then we will see the < Code>? are added to prevent the default nature of the [QSA] (the query string append) on a string, a new query string is not created to make it a permanent rewrite Add [R] flag to:

  #External Redirect RewriteCond% {QUERY_STRING} pcord = ([A-Za-z0-9] +) rewrite ^ story .php story /% 1? [R = 301, L]   

If you have to send this magic back to the original string, you have to capture it in reverse ways. Note: You will not use the [R] flag here because it asks to redirect the browser. :

  #Internal Forward RewriteRule ^ Story / ([A-Za-z0- 9] +) story.php? Pcord = $ 1 [L]   

Remember that you already have the [R = 301] directive, this is probably cached in your browser.

Now, you can type in pcord in PHP to $ _GET ['pcord'] . The last code for

.htaccess will be:

  RewriteEngine On RewriteBase / #Eternal RestirectRewriteCond% {QUERY_STRING} pcord = ([A-Za -z0- 9] +) Rivetrium ^ story.php Story /% 1? [R = 301, L] #Interior Forward Rearrittel ^ Story / ([AZA-J 0-9] +) story.php? Pcord = $ 1 [L] RERETE condom% {REQUEST_FILENAME}! ^ Story revoked% {REQUEST_FILENAME} \ .php $ RewriteCond% {REQUEST_FILENAME}! -f rewrite% {REQUEST_FILENAME}! -d # Create external redirects for all existing .php files, which are not the story. PHP RewriteRule ^ ([^ /] +) \ php $$ 1 / [R = 301, L] # Prepare the internal forward, which they reverted to% {REQUEST_FILENAME} ^ {* A-Za-z0- 9] +) /? $ RewriteCond mounts to hide in% {REQUEST_FILENAME}! -d RecoveryCand% 1 \ .php -f Rewrite Rule ^ ([^ /] +) /? $ $ 1.php [L]    

No comments:

Post a Comment