How to remove file name & parameter from URL, but keep parameter value using .htaccess? -
current url: http://broom.xyz/index.php?tag=c/santa
goal url: http://broom.xyz/c/santa
note: tag 'c/santa' single dynamic value.
can change 'f/fanta' or 'm/manta'.
my code:
rewriteengine on rewritebase / rewritecond %{env:redirect_status} ^$ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_filename} !-l rewriterule ^([^/]*)$ /index.php?tag=$1 [l]
this code generates 500 internal server error. here error log:
[fri apr 07 13:33:10.469218 2017] [core:alert] [pid 4202] [client 47.11.122.64:52755] /var/www/html/workspace/broom/.htaccess: invalid command 'rewriteengine', perhaps misspelled or defined module not included in server configuration [fri apr 07 13:40:31.595944 2017] [core:alert] [pid 4185] [client 47.11.122.64:53076] /var/www/html/workspace/broom/.htaccess: invalid command 'rewriteengine', perhaps misspelled or defined module not included in server configuration
your rule's pattern not match uri c/santa matches csanta because have excluded / in pattern ^([^/]*) . need fix can accept chars in uri.
replace rewriterule line :
rewriterule ^(.+)$ /index.php?tag=$1 [l]
Comments
Post a Comment