DEV Community

Teddy Zugana
Teddy Zugana

Posted on • Edited on

1 2

Phalcon Framework Php Htaccess for Apache and CORS Blocked

.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]
Enter fullscreen mode Exit fullscreen mode

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs