1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Question: Wordpress URL estensions ending with "/" or ".php"?

Discussion in 'WordPress' started by Mr.Dog, Nov 11, 2018.

  1. #1
    Hi,

    I am planning to move an offline .PHP static site to WordPress. I will do my best to keep my old .php URLs, but... a problem has arisen:

    What extensions are Wordpress pages? .PHP?

    Because most of the time when browsing blogs, I see no extension, but merely "/" at the end of the URL.

    Example - my current static .PHP pages look like this:
    mysite.com/thailand/trip-to-bangkok.php

    But blogs, which I read all lack the .php/.htm extension:
    blogsite/thailand/trip-to-bangkok/

    Basically there's eigher a slash (/) or nothing at the end.
    How will it be with WordPress? Can I chose to display or not display the extension?
     
    Mr.Dog, Nov 11, 2018 IP
  2. MilesWeb

    MilesWeb Well-Known Member

    Messages:
    869
    Likes Received:
    35
    Best Answers:
    7
    Trophy Points:
    173
    #2
    Yes. You can make your own decision whether to keep or not to keep the extension.
    However, if you choose to hide the extensions from your URL you need to make changes with the htaccess file.
    Here's what you need to do:
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^(.*)$ $1.php
    Code (markup):
    Save the changes and your URL: mysite.com/thailand/trip-to-bangkok.php will appear as mysite.com/thailand/trip-to-bangkok/
     
    MilesWeb, Nov 12, 2018 IP
    Mr.Dog likes this.
  3. thefan

    thefan Well-Known Member

    Messages:
    12
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    118
    #3
    WordPress allows you to choose from a handful of presets when it comes to URL formatting but you will be able to write your own, too. You can go to Settings / Permalinks from the WordPress Dashboard and set the one you like most.
    You can set it up to show your links in the format "yourtext.php" if you like.
     
    thefan, Nov 13, 2018 IP
  4. Mr.Dog

    Mr.Dog Active Member

    Messages:
    912
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Yes, this is all very useful, but I hope the above htaccess setting is not a redirect setting, just a mere "change the looks" setting.
     
    Mr.Dog, Nov 15, 2018 IP
  5. MilesWeb

    MilesWeb Well-Known Member

    Messages:
    869
    Likes Received:
    35
    Best Answers:
    7
    Trophy Points:
    173
    #5
    No. It's not a redirect setting. It will only hide the extensions from your URLs
     
    MilesWeb, Nov 21, 2018 IP
  6. Mr.Dog

    Mr.Dog Active Member

    Messages:
    912
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Thank you very much for the code, I will be able to use it.

    But my original question is still unanswered: originally, what extensions .htm/.php are Wordpress pages?

    I need to know if Wordpress supports .php
     
    Mr.Dog, Dec 1, 2018 IP
  7. MilesWeb

    MilesWeb Well-Known Member

    Messages:
    869
    Likes Received:
    35
    Best Answers:
    7
    Trophy Points:
    173
    #7
    The default extension of all webpages in WordPress is .php
     
    MilesWeb, Dec 3, 2018 IP
  8. Mr.Dog

    Mr.Dog Active Member

    Messages:
    912
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    60
    #8
    So the .php should normally show, correct?
     
    Mr.Dog, Jan 2, 2019 IP