1

I've a question, I'm developing a webservice for a specific app. Last week I transferred my back-up from server1 to server2, since that moment my .htaccess won't work anymore.

The url for my webservice is: http://apps.holtesdesign.nl/inholland/apiv0/

This url works fine, to load the bugreport module: http://apps.holtesdesign.nl/inholland/apiv0/bugreport.php

But the url was supposed to be: http://apps.holtesdesign.nl/inholland/apiv0/bugreport

When you'll open the last url, you'll see that it will result in an internal server error. Do you know how it's possible?

My .htaccess looks like:

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

The server is running on CentOS, and I've already checked if mod_rewrite is functioning...

I hope you can help me guys!

Cheers,

Jelmer

4 Answers 4

6

This will fix it:

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

If it doesn't work correct the settings of your Wamp Server:

  1. Left click WAMP icon
  2. Apache
  3. Apache Modules
  4. Left click rewrite_module.
Sign up to request clarification or add additional context in comments.

3 Comments

unfortunately, it won't. I've replaced the .htacces file with your code
Where is the .htaccess file?
The .htaccess file was in the same directory, now I've deleted it, and put it in the parent directory, which worked with your code. It was a very strange problem!
5

This will hide the trailing slash and hide .php in root & sub directories.

RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*?)/?$ $1.php [NC,L] 

Comments

0

Working Concept for me:

# Options is required by Many HostSevice Options +MultiViews RewriteEngine on # For .php & .html URL's: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] RewriteRule ^([^\.]+)$ $1.html [NC,L] 

Use this code in Root folder of your website in .htaccess File : Example

offline - wamp\www\YourWebDir

online - public_html/

Important Note : If it doesn't work correct the settings of your Wamp Server: 1) Left click WAMP icon 2) Apache 3) Apache Modules 4) Left click rewrite_module

Comments

0

try this.. it works! :)

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.