Jump to content

mod_rewrite for API


Tyler Cassidy

Recommended Posts

Posted

Hi, I'm trying to setup a proper mod_rewrite rule to get the API working with my website without using .htaccess. Currently I have the following but it doesn't seem to redirect to the API just the main website. Any ideas?

 

Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(js|css|jpeg|jpg|gif|png|ico)(\?|$) fcgi://127.0.0.1:9000/home/tyler/ips/404error.php [P,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/api/.* fcgi://127.0.0.1:9000/home/tyler/website/api/index.php [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},P]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . fcgi://127.0.0.1:9000/home/tyler/www.yegdnb.com/index.php [P]

Posted

Ok I figured it out just had to tweak my condition statement a bit:

 

Options -MultiViews 
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(js|css|jpeg|jpg|gif|png|ico)(\?|$) fcgi://127.0.0.1:9000/home/tyler/www.yegdnb.com/404error.php [P,NC]

RewriteCond %{REQUEST_URI} ^/api/.*
RewriteRule . fcgi://127.0.0.1:9000/home/tyler/www.yegdnb.com/api/index.php [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},P]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . fcgi://127.0.0.1:9000/home/tyler/www.yegdnb.com/index.php [P]

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...