.htaccess mod rewrite rule

Discussion in 'PHP' started by postcd, Feb 24, 2014.

  1. #1
    Hello,

    i have english.php page and i want to use just mydomain.com/?en to show english.php page, also i need in address bar to be "?en" and not change to "english.php" (so visitor see pretty url)

    Please how this rewrite rule should look like? Thanks alot for help
     
    postcd, Feb 24, 2014 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    I think you're misunderstanding "pretty urls" if that's what you think a pretty Url is. Better to use /english or just /en - ditch the question mark
     
    PoPSiCLe, Feb 24, 2014 IP
    DomainerHelper likes this.
  3. makeit easy

    makeit easy Active Member

    Messages:
    2,067
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #3
    It's better not to direct it for SEO.
    I think yourdomain/en.php or yourdomain/english.php is the best version for the page.
    If you still want it to be redirected,
    create a directory "en" or "english"
    create a file named "index.php" and copy-paste your "english.php" file to it.
    create a .htacess file under "en" or "english" directory
    add this code: "directoryindex index.php"
    With this solution, you can display the page as yourdomain/en/ or yourdomain/english/
    But also yourdomain/en/index.php You can redirect yourdomain/en/index.php to yourdomain/en/. But I would use the first method, yourdomain/en.php
    Pretty URL means not having question mark in the URL. It's good for SEO.
     
    makeit easy, Feb 25, 2014 IP