dropson
dropson

Reputation: 1121

In wordpress allow an URL to redirect to a php file outside wordpress

I run a wordpress blog on mydomain.com

I want requests to mydomain.com/app rewritten to the folder "wp-installation/app/app.php"

This is my current .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Any help is appreciated.

Upvotes: 0

Views: 170

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

Try this

<IfModule mod_rewrite.c>
 RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/app/?$
RewriteRule ^.* /wp-installation/app/app.php [NC,L]
RewriteRule . /index.php [L]
</IfModule>

I added a condition to check if the Requested URI string contains "/app" then it will be rewritten to /wp-installation/app/app.php ,otherwise to the index.php file.

Upvotes: 1

Related Questions