Jump to content

Hide PHP extension


dhope

Recommended Posts

Hi,

 

I currently have the following code in my .htaccess to remove the .php extension from my files.

 

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME}\.php -f

RewriteRule ^(.*)$ $1.php

 

How would I change this so that "www.mydomain.com/services" becomes "www.mydomain.com/page/services"

 

I'm not really that clued up on mod_rewrite, please can someone point me in the right direction.

 

Thank you :)

Link to comment
Share on other sites

Not sure what you want to do here.

 

Do you want  www.mydomain.com/services to be redirected to www.mydomain.com/pages/services and then have www.mydomain.com/pages/services call www.mydomain.com/services.php?

 

Or just have www.mydomain.com/services call www.mydomain.com/pages/services.php

Link to comment
Share on other sites

Not really. You should start your links with a / that way your links will always load from the root of your site. Otherwise when you go to mydomain.com/pages/services your web browser will try to load your images/css files from mydomain.com/pages/services

Link to comment
Share on other sites

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.