mod rewrite - Having a problem with mod_rewrite adding a trailing slash -
i'm using mod_rewrite turn friendly urls ( site.com/page/ ) script friendly ( ?page=page ) working except 1 thing. if leave off trailing slash on url breaks , gets 404.
i tried using solution in this post (slightly modified), doesn't appear working. reference here .htaccess rewrite;
<ifmodule mod_rewrite.c> rewriteengine on options +followsymlinks options +indexes rewriteengine on rewritebase / #force trailing slashes on real directories rewritecond %{request_filename} -d rewritecond %{request_uri} !(.*)/$ rewriterule ^(.*)$ $1/ [r] rewriterule ^images - [l] rewriterule ^([^/]*)/$ /?page=$1%{query_string} [l] </ifmodule>
so want last/skip on directory test - guessing - , need modify:
rewriterule ^([^/]*)/$ /?page=$1%{query_string} [l]
into either 2 of them - dealing / , non-slash case - or one
rewriterule ^([^/]*)/?$ /?page=$1%{query_string} [l]
assuming that want. propably want bit more likel
rewriterule ^([^/.]+)/?$ /?page=$1&%{query_string} [l]
i've added & - guessing need too.
Comments
Post a Comment