Jump to content

remove .php extensions


Love2c0de

Recommended Posts

Good afternoon,

 

I'm having a really weird problem with my attempt at re-writing URL's.

 

I'm trying to remove the .php extension from my filename within the URL. 

 

It works fine with pages 'portfolio.php, terms.php and promise.php' but not any of the other pages. The other pages send me to a redirect loop error.

 

Here is my rewrite rules:

RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME}.php -fRewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [L]

 

filenames are as guessed, index.php, services.php, contact.php etc, as you can see only those certain pages listed above work.

 

Does anyone know why?

 

Thank you for your time.

 

Kind regards,

 

L2c

Link to comment
https://forums.phpfreaks.com/topic/286614-remove-php-extensions/
Share on other sites

Hi Ch0cu3r,

 

Thank you for the reply and sorry for the late reply.

 

I ended up taking another route. I did look at the link you provided but it was too complicated at the time.

 

Would you be able to help me solve my next problem?

 

I used this code to get what I needed:

 

RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME}.php -fRewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [L]

 

I have a 'portfolio.php' page with some project links. When those links are clicked it accepts a GET variable and pulls the relevant information from the database - displaying it on 'project.php'. So project.php acts as a template for different content.

 

How can I modify my .htaccess rules to compensate for when there is a GET variable passed?

 

Thank you for your time.

 

Kind regards,

 

Tom

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.