Apache 2.4 .htaccess friendly URL rewrite -


having issues understanding .htaccess file , getting work properly. .htaccess recognized....i entered plain test @ top , got internal server error. , appears mod-rewrite working...because downloaded test php file , works.

i using apache 2.4.23 no php pages

however cant seem work right.

i trying take url

http://example.com/projecttest/index.shtml?dyncontent=content1 

and rewrite this

http://example.com/projecttest/content1 

i trying generically across site since ?dyncontent=whatever constant.....and trying keep same path.....like below example

change this

http://example.com/projecttest/projectfolder/index.shtml?dyncontent=content1 

to this

http://example.com/projecttest/projectfolder/content1 

i not .htaccess files

update: ok...i got work.....not sure why works....but when type in test-dev/projecttest/apples or test-dev/projecttest/oranges calls appropriate content.

this used

rewriterule ^projecttest/([^/\.]+)/?$ projecttest/index.shtml?dyncontent=$1 [l] 

and rewrote , works directory

rewriterule ^(.*)/([^/\.]+)/?$ $1/index.shtml?dyncontent=$2 [l] 

try this:

rewriteengine on rewritecond %{query_string} ^dyncontent=(.+)$ rewriterule ^/(.+)+/index.shtml $1/%1 [pt] 

this requires mod_rewrite activated. value of bracket in dyncontent=(.+) stored in %1 , bracket's value in ^/(.+)+/index.shtml stored in $1. both creates target path http://example.com/projecttest/projectfolder/content1


Comments