Showing posts with label Cross-Origin. Show all posts
Showing posts with label Cross-Origin. Show all posts

Friday, March 20, 2015

Remove nginx and re activate apache

Remove nginx and re activate apache

 
//First, you need to stop nginx so it releases port 80 so that apache2 can listen to it later on.
-------------------------------------
sudo service nginx stop                                                           

//Next, if nginx was installed with apt-get, removing it would be as simple as

sudo apt-get remove nginx

//Instead, you can also use

sudo apt-get purge nginx

//First one removes all package files, while the second also removes the configuration files.
//If you intend to use nginx later on with the configuration you did, use remove. Else, I would suggest using purge.

//After removing nginx, you can restart apache to make sure it is listening to port 80.

sudo apache2ctl restart

//If you had removed apache before installing nginx, you can re-install it with

sudo apt-get install apache2 
 
 

Wednesday, February 25, 2015

Cross-Origin Request Blocked ?

ERROR : Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at the url. This can be fixed by moving the resource to the same domain or enabling CORS.



Solution :

If you are working on web project  and want to get data from different site , Sometime you get such type of error 

" Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at the url. This can be fixed by moving the resource to the same domain or enabling CORS. "

then you have to use .htaccess file 

update code

<FilesMatch "\.(php)$">
  <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
  </IfModule>
</FilesMatch>           




if you havn't    .htaccess file then create a file in root folder and update following code 
Following code for wordpress project please change according to your Project 


# BEGIN WordPress
<IfModule mod_rewrite.c>
  RewriteEngine On

 RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond
   %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]
</IfModule>
<FilesMatch "\.(php)$">
   <IfModule mod_headers.c>   
     Header set Access-Control-Allow-Origin "*"
   </IfModule>
</FilesMatch>
# END WordPress



Enjoy Coding  :) 



comment please :)

How to Host a Laravel Project on Hostinger’s hPanel: A Step-by-Step Guide

How to Host a Laravel Project on Hostinger’s hPanel: A Step-by-Step Guide If you're looking to host a Laravel project on Hostinger’s hPa...