Jump to content

Photo
- - - - -

Remove PHP, HTML extension from your URL


  • Please log in to reply
14 replies to this topic

#11 SreejithMJ

SreejithMJ

    Level 1

  • Members
  • Level
  • 43 points
  • 18 posts

Posted 05 September 2010 - 10:50 PM

Its still showing .php extension



It won't change ur urls bro! instead try www.yoursite.com/home and it will automatically load the page www.yoursite.com/home.php
<?= 'Poet in Coding' ?>

#12 leonsky

leonsky

    Level 4

  • Members
  • Level
  • 49 points
  • 200 posts
    • Gender:Male
    • Location:Malaysia
    • Software:SE 4.5.x

Posted 28 September 2010 - 02:18 PM

I saw some request in SEF for removing PHP, extension from URL.. you can do it by .htaccess files
here we go

Demo:
Before
www.yoursite.com/index.php
after
www.yoursite.com/index

Open your htaccess files add below code for php

Options +FollowSymLinks
  Options +Indexes
  RewriteEngine on
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteRule ^([^\.]+)$ $1.php [NC,L]

for html
just add like this
RewriteRule ^([^\.]+)$ $1.html [NC,L]

I hope who had request of it, now solved problem.
thanks


Its still showing .php extension

#13 phihung163

phihung163

    Level 3

  • Members
  • Level
  • 7 points
  • 55 posts

Posted 14 February 2011 - 03:47 AM

I have same problem!

Edited by phihung163, 14 February 2011 - 03:53 AM.

------------------------------------------------------
Sorry! I'm not good at English!

#14 abatu

abatu

    Level 4

  • Members
  • Level
  • 18 points
  • 206 posts

Posted 02 April 2011 - 08:09 AM

it's work like charm,But In all .tpl files remove extensions in <form> tag, update all links and create rewrite rule.
and+rep

Edited by abatu, 02 April 2011 - 08:10 AM.


#15 Guenscher

Guenscher

    Level 1

  • Members
  • Level
  • 7 points
  • 13 posts

Posted 11 April 2016 - 09:09 PM

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On
  RewriteBase /
  RewriteRule ^([A-Za-z_-]+)$ /profile/$1 [R]
  RewriteCond %{HTTP_HOST} ^www\.yourwebsite\.com [NC]
  RewriteRule ^(.*)$ https://www.yourwebsite.com/$1 [L,R=301]

  # Get rid of index.php
  RewriteCond %{REQUEST_URI} /index\.php
  RewriteRule (.*) index.php?rewrite=2 [L,QSA]

  # Rewrite all directory-looking urls
  RewriteCond %{REQUEST_URI} /$
  RewriteRule (.*) index.php?rewrite=1 [L,QSA]

  # Try to route missing files
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} public\/ [OR]
  RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
  RewriteRule . - [L]
 
  # If the file doesn't exist, rewrite to index
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]
 
  </IfModule>

# sends requests /index.php/path/to/module/ to "index.php"
# AcceptPathInfo On

# @todo This may not be effective in some cases
FileETag Size

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>

 

 

Change yourwebsite.com to yours






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


All the resources listed here are just for testing purpose and they shouldn't be used at any commercial environment without a valid license.
Those are for users who wants to try them before buy. Help the developer to build it better by purchasing them from original authors.