Jump to content

Remove .php from url


frshjb373

Recommended Posts

I want to remove .php extension from all my urls. I've tried a ton of htaccess codes that I found on the web, but nothing seems to work.  Isn't there a way to refer to a page within your site simply by naming the file name without the extension?  For example, I currently have:

<a href="birds.php">Birds</a>

  But how do I make something like the following work?

<a href="birds">Birds</a>

or

<a href="/birds">Birds</a>

  Any help would be much appreciated.  Thanks in advance!

Link to comment
Share on other sites

Unfortunately that did not work.  Should I be referring to my pages in the code without the .php or use a slash in front of the page?

 

Also, the rule you provided broke my redirect code:

 

RewriteEngine on
<Files .htaccess>
order allow,deny
deny from all
</Files>

ErrorDocument 404 /404.php

RewriteCond %{HTTP_HOST} ^joytothewild\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.joytothewild\.com$
RewriteRule ^(.*)$ "http\:\/\/www\.joytothewildphotos\.com\/$1" [R=301,L]

 

Any other ideas?  Also, thank you for the help.

Link to comment
Share on other sites

Paste what you've done because you've got a redirect in there with a last option.

 

Moreover, you've got unnecessary stuff in that file.

 

RewriteCond %{HTTP_HOST} ^(www\.)?joytothewild\.com$
RewriteRule ^(.*)$ "http\:\/\/www\.joytothewildphotos\.com\/$1" [R=301,L]

 

I'm not really sure what the deal with <Files> is but it looks like your denying the use of any htaccess files....

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.