Jump to content

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

Edited by Love2c0de
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

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.