php - Shortening URL using .htaccess -


my folder structure is:

modules

  • admin

    • index.php
  • login

    • login.php
    • signup.php
  • articles

    • articles.php

my current url is:

localhost/modules/admin/index.php

localhost/modules/login/login.php

localhost/modules/articles/articles.php

i want change to:

localhost/index

localhost/login

localhost/articles

since beginner in using .htaccess file, pls me how can change url using .htaccess file

your folder structure makes difficult have universal rule should able use these rules.

rewriteengine on  rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule ^ - [l]  rewriterule ^(index)/?$ /modules/admin/$1.php [nc,l,qsa] rewriterule ^(login|articles)/?$ /modules/$1/$1.php [nc,l,qsa] 

Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -