.htaccess - apache htaccess map first segment as parameter without disturbing other parameters -


this might classic .htaccess question, still couldn't find question specific case. here's closest found (parameters involve in case). done implementing 2 answers. couldn't work case.

my case

1) want access url,

mywebsite.com/any-first-segment?param1=a&param2=b&param3=c&paramn=anything 

will remapped to

mywebsite.com/index.php?p=any-first-segment&param1=a&param2=b&param3=c&paramn=anything 

2) still working if there's no param.

3) never have more 1 segment. (zero segment still works, mapped index.php usual)


could suggest me working rewriterule case?

here's last .htaccess, still not working

options +followsymlinks rewriteengine on rewritecond %{request_filename} !-l rewriterule ^(.+)$ index.php?p=$1 [qsa,l] 

[updated!] it's working. found messed options +followsymlinks after reading this

here's working .htaccess. exception.

rewriteengine on rewritecond $1 !^(index\.php|images|robots\.txt|css) rewriterule ^(.+)$ index.php?p=$1 [qsa,l] 

using qsa flag in rule append current query string rewritten form.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -