php - HTACCESS Trailing Slash + Empty GET Var -


i'm quite new htaccess command line. running few problems

1. when no get[] variable inputted, page redirects error page, in php code have default function cover this. how prevent happening , still load code.
2. how redirect page bad link clean link. example: adminpage.php -> admin/view/...
i've looked @ discussion redirects, not seem working me: redirect *.php clean url
3. when there not trailing slash @ end of link empty get[] var, fails load , redirects error page. example: /index/r/2 -> /index/r how prevent this.

i've looked @ discussion trailing slashes, helps basic missing slashes, not when get[] variable missing too..
htaccess: add/remove trailing slash url

# follow symbolic links options +followsymlinks  # turn rewrite engine on rewriteengine on  rewritecond %{request_filename} !-f  rewritecond %{request_filename} !-d  rewriterule ^(.*)/$ /$1 [l,r=301]  rewriterule ^index/r/(\w*)$ /index.php?r=$1  rewriterule ^index/r/(\w*)/(\w*)$ /index.php?r=$1&p=$2  rewriterule ^admin/login$ /admin.php  rewriterule ^admin/view/(\w*)$ /adminpage.php?p=$1 

are aware of performance issues re htaccess?

$_get[] protocol specific while $_request[] doesn't care reg v post.

so can handle missing inputs

<code> if ( empty($_request[]) ) {    // error logic } else    // process cgi inputs } </code> 

btw: strange cgi program gets invoked without inputs. imo front end should have caught onsubmit() , avoided round trip nothing.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -