Jump to content

Recommended Posts

Hello again.

 

I've been trying to hide my url extension lately. If it is yourdomain.com/management.php then i wan to make it yourdomain.com/management

 

After exploring various tutorials i've found out that writing the following code in the .htaccess file would help.

 

RewriteEngine On
RewriteCond %{REQUEST_URI}  !-d
RewriteCond %{REQUEST_URI}  !-f
RewriteCond %{REQUEST_URI}  !\.php$
RewriteRule  ^(.*)$  /$1.php  [L]

 

Also i've changed all internal links in my website (eg. from

<a href="management.php">Link</a>

  to

<a href="/management">Link</a>

)

 

However it still does not work :s

 

Is there something wrong with the code?

 

 

http://newmediarts.blogspot.be/2007/01/hide-file-extensions-in-urls-with.html

 

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

 

 

I saw some other examples of mod rewriting and i figured that i have o do something with the last line

RewriteRule ^(.*)$ $1.php

 

So if i want make it from myFile3.php to myFile then i should write something in that 4th line?

That you for your help guys. I found a solution. I've added one line at the top:

RewriteBase /

 

So full code would be;

RewriteBase /

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

I will not create yet another topic and ask this in here.

 

I've got this url:

http://kingstonuni.atspace.co.uk/social/user_profile.php?id=14

which i want to convert to:

http://kingstonuni.atspace.co.uk/social/14

or:

http://kingstonuni.atspace.co.uk/social/user_profile/14

 

what extra line of code should i add?

 

Thank you very much for your kind help.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.