homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

URL Slash Problem
mysite/ (a PHP file) leads to "Internal Server Error"

 12:18 am on Apr 14, 2008 (gmt 0)

Does anyone know why visiting my site at [mysite.com...] (which is the same as [mysite.com...] I'm using a Rewrite rule to make it extensionless) gives me an "Internal Server Error" message?

Visiting [mysite.com...] or [mysite.com...] gives no errors, though.

I'm thinking that the slash will make the server think that is a directory and that's why it's giving me the error message. I might be wrong, though. Hopefully you guys came across this before and can share some solutions. Thanks for reading this!



 12:14 am on Apr 15, 2008 (gmt 0)

I could just ignore the mysite.php/ slash. But the problem is that I need that slash to create dynamic URLs.

For instance, I have [mysite.com...] (.php extension can be removed here, but you get the idea).

Then, I use a super variable $_SERVER['REQUEST_URI'] and the explode() function to split the URL in different parts. That way I can manipulate variables and work with my site using Clean URLs.


 1:33 am on Apr 15, 2008 (gmt 0)

You might want to look at your server error log....



 7:00 am on Apr 26, 2008 (gmt 0)

Hi jdMorgan,

I just checked my Apache Server Log just after trying to visit the .php file with a slash at the end and this is the Apache error I got:

mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.

Do you know what this means?


 6:20 pm on May 8, 2008 (gmt 0)

Could you please post the ruleset you are using.

Apparently, there is some type of recursion causing an infinite loop on your rewrite.


 6:53 pm on May 8, 2008 (gmt 0)

Before you redirect or rewrite, you need to exclude certain requests from causing the redirect or rewrite to be processed.

You'll need one or more RewriteCond statements to be added before the redirect or rewrite.


 11:29 pm on May 8, 2008 (gmt 0)

Hi guys,

Apparently I've managed to get some progress here.
Now if I browse:

my-site.com/example.php/ or

It works just like:

my-site.com/example.php and

However, there is a problem. If there is a slash after the .php file, for some reason I can't see my CSS files being applied to the page. My page loses all the CSS styles. Very strange, I don't know why this happens. And also, if I visit:


It works perfectly. The file example.php is still being read. All I have now is "page1/page2/example_page_here", which I can use some PHP functions, such as EXPLODE and have each component of the URL in an Array so I can work with them. You get the idea right? Well the problem is that visiting:

my-site.com/example/page1/page2/example_page_here (no extension in example.php file)

...it doesn't work. I get a 404 File Not Found error. Apparently because it believes I'm trying to visit a directory, which is certainly not what I'm looking for. I'm pretty sure you guys know why I have "page1/page2/example_page_here" after the .php file. It's not really a directory, but more like a fake directory that I'll use to pass parameters to my page and work with those in my PHP code.

This is the code I'm using in my .htaccess file:
## Converts test.php to test
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
##RewriteRule ^(.*)$ $1.php
RewriteRule ^([^/]+)/?$ $1.php [L]

Do you guys know why I'm having this problem? Is there a rule I could write in my .htaccess file to fix this?

Thanks a lot, I really appreciate your help!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved