MrGrinst
MrGrinst

Reputation: 1000

.htaccess PHP Controller Internal Server Error

I'm creating a PHP controller for testing purposes on my domain. The domain, by default, is entirely on Wordpress and I'm having issues setting up just the folder testing1 to be controlled by my PHP controller. Here's the code in my .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


RewriteRule . /index.php

RewriteRule ^testing1/(.*)$ ./testing1/controller.php

</IfModule>

# END WordPress

When I go to mydomain.com/testing1/ I get an internal server error. Any help is appreciated. Thanks!

Upvotes: 0

Views: 74

Answers (2)

web2kx
web2kx

Reputation: 71

Get rid of ./, which is used to point to current directory.

RewriteRule ^testing1/(.*)$ testing1/controller.php

I have it working.

Upvotes: 3

Jim Martens
Jim Martens

Reputation: 359

The RewriteRules are executed in order. If one does match, the rest is ignored. So the result might look like this (just the RewriteRules):

RewriteRule ^testing1/(.*)$ /testing1/controller.php    
RewriteRule . /index.php

The second rule does mean that when you type exactly one character (whatever it is), you will get directed to index.php. I don't know though if that is your intended behaviour.

Upvotes: 0

Related Questions