Jump to content

remove file name and extention


The Little Guy

Recommended Posts

Hi The Little Guy

 

To remove the file name and its extention, you have to write php script or use mod_rewrite module.

 

I want to show you mod_rewrite,apache module.To use this module you have a apache server,and there is a .htaccess file your host. You modify this file to change URLs.You can write and examine that rules ,

 

RewriteEngine On

RewriteBase /

RewriteRule ^school/images/(.*)$  images/$1

RewriteRule ^school/(.*).html      index.php?id=$1

 

After this rule you can use www.xxx.com/school/1.html so you hide your .php extension if you want remove extensions complately,use that

RewriteEngine On

RewriteBase /

RewriteRule ^(.*)      index.php?id=$1

 

then you can use www.xx.com/1 for example.

 

take care,bye :)

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.