.htaccess - htaccess convert request to clean url and add slash at the end of the url -
ok , searched more 4 days , more 20 posts here in stach or in websites without kind of success
first here htaccess file
rewriteengine on rewriterule ^([a-za-z0-9_]+)/?$ index.php?page=$1 [nc] rewriterule ^([a-za-z0-9_]+)\/([a-za-z0-9_]+)\/?$ index.php?page=$1&action=$2 [nc]
i tried many codes 1 worked me can call request , works me
www.example.com/pagename => www.example.com/index.php?page=pagename
here questions , please provide me information "in detail" understand code well
1- how convert request automatically www.example.com/index.php?page=pagename www.example.com/pagename
2- if tried add slash @ end shows me page without images or styling mean www.example.com/pagename => works www.example.com/pagename/ => doesn't work
that's :)
for first part need 301 rule this:
rewritecond %{the_request} /index\.php\?page=([^\s&]+) [nc] rewriterule ^ /%1? [r=301,l]
for second part use absolute path in css, js, images files rather relative one. means have make sure path of these files start either http://
or slash /
.
Comments
Post a Comment