loading...

Phalcon Framework Php Htaccess for Apache and CORS Blocked

kevinmel2000 profile image Teddy Zugana Updated on ・2 min read

.Htaccess file on phalcon index folder :


RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.)
RewriteCond %{HTTP:Authorization} ^(.)

RewriteCond %{HTTP:Authorization} ^(.
)$
RewriteRule .* - [e=HTTP_AUTHORIZATION:{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^$ public/ [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
RewriteRule (.*) public/$1 [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]

.Htaccess file on phalcon public folder :

AddDefaultCharset UTF-8


SetEnvIf Origin "http(s)?://(www.)?(google.com|staging.google.com|development.google.com)$" AccessControlAllowOrigin=$0
Header set Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
Header merge Vary Origin
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header set Access-Control-Allow-Headers "Authorization, X-Requested-With, Content-Type, Origin, Accept, client-security-token"
Header set Access-Control-Expose-Headers "Content-Security-Policy, Location"
Header set Access-Control-Allow-Credentials "true"



SetEnvIf Origin "http(s)?://(www.)?(google.com|staging.google.com|development.google.com)$" AccessControlAllowOrigin=$0
Header set Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
Header merge Vary Origin
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header set Access-Control-Allow-Headers "Authorization, X-Requested-With, Content-Type, Origin, Accept, client-security-token"
Header set Access-Control-Expose-Headers "Content-Security-Policy, Location"
Header set Access-Control-Allow-Credentials "true"

RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteCond %{HTTP:Authorization} ^(.)   
RewriteCond %{HTTP:Authorization} ^(.*)$ 
RewriteRule .* - [e=HTTP_AUTHORIZATION:{HTTP:Authorization}] 
RewriteRule ^index\.php$ - [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
RewriteRule ^(.*)$ index.php?_url=/$1 [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]

Discussion

pic
Editor guide