Skip to main content

Forums

This topic contains 1 reply, has 2 voices, and was last updated by  Pogany 10 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #271262

    wmetraining
    Participant

    I have a single file index.php that can accept variables like index.php/?kw=my_keyword and change what is on the page using $_GET["kw"]

    Instead of creating a bunch of subdirectories I want my htaccess to create virtual subdirctories.

    If the URL www.example.com/my-keyword is used that URL will stay the same but show the content for www.example.com/ndex.php/?kw=my_keyword

    What do I need in my htaccess to do this?

    #271286

    Pogany
    Participant

    Hi,
    I can’t answer your question since the editor is deleting my answer over and over.

    I try again:

    <IfModule mod_rewrite.c>

    RewriteEngine on

    These lines are saying: “If mod_rewrite exists turn on the rewrite engine.
    Then you define your rule:

    RewriteRule ^index/([A-Za-z\_]+)/?$ index.php?kw=$1

    This is using regex to identify the URL to mach. You may need to change the regex.

    Finally you need to close the IfModule;

    </IfModule>

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

icon-link icon-logo-star icon-search icon-star