mod_rewriteを使用しているときにURLを介してデータを渡したい。stackoverflowや他のサイトで多くのリンクを読みましたが、解決策が見つかりません。
結果のURLは次のとおりです。
http://example.com/Path/logmanagement/view/1/?name=3&type=klik
print_rは以下を返します:
Array ( [action] => logbeheer [do] => view [id] => 1 )
現在私はこのhtaccessを持っています:
Options -Indexes
ServerSignature Off
RewriteEngine On
#RewriteBase /
##this part is what I tried##
RewriteCond %{QUERY_STRING} ^name=(\d+)&type=(\w+)$
RewriteRule ^([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-+]+)/([a-zA-Z_0-9-+]+)/([a-zA-Z_0-9-+]+)$ index.php?action=$1&do=$2&id=$3&name=%1&type=%2
RewriteRule ^([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-+]+)/([a-zA-Z_0-9-+]+)/([a-zA-Z_0-9-+]+)/$ index.php?action=$1&do=$2&id=$3&name=%1&type=%2
##end this part##
# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"
RewriteCond %{QUERY_STRING} http\: [OR]
#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]
#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]
#OR if the URI contains a "<script>"
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#OR script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#OR any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^.*$ - [F,L]
# END Filtering
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z_0-9-]+)$ index.php?action=$1
RewriteRule ^([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-]+)$ index.php?action=$1&do=$2
RewriteRule ^([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-+]+)$ index.php?action=$1&do=$2&id=$3
RewriteRule ^([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-+]+)/([a-zA-Z_0-9-+]+)$ index.php?action=$1&do=$2&id=$3&id2=$4
RewriteRule ^([a-zA-Z_0-9-]+)/$ index.php?action=$1
RewriteRule ^([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-]+)/$ index.php?action=$1&do=$2
RewriteRule ^([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-+]+)/$ index.php?action=$1&do=$2&id=$3
RewriteRule ^([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-+]+)/([a-zA-Z_0-9-+]+)/$ index.php?action=$1&do=$2&id=$3&id2=$4
RewriteRule ^([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-]+)/([a-zA-Z_0-9-+]+)/([a-zA-Z_0-9-+]+)/([a-zA-Z_0-9-+]+)/$ index.php?action=$1&do=$2&id=$3&name=%1&type=%2
# Fixed upload issues for the milti file upload
SetEnvIfNoCase Content-Type "^multipart/form-data;" "MODSEC_NOPOSTBUFFERING=Do not buffer file uploads"