Magento REST API response getting 404 - magento

We configured the REST API user and permissions from magento admin side.
Then we tried the Authorization method with customer key and secret and got the access token and token secret.
Then we tried to call the API URL with OAuth version 1.0
[Magentosite]/api/rest/products
but end with a 404 error.
Also some where i found the url need to be in below format...
[Magentosite]/api.php?type=rest/products
but end with a Invalid webservice adapter specified.
Using magento version - 1.9.0.1
Can someone please suggest what is wrong in this end url calls ?
It worked and got response after we put below changes in apache file
/etc/apache2/sites-available/default
<Directory /var/www/mymagento/>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>

In my case the .htaccess of the production server was missing the following line, I figured out by comparing my localhost and production server's .htacess file.
############################################
## rewrite API2 calls to api.php (by now it is REST only)
RewriteRule ^api/rest api.php?type=rest [QSA,L]

In my case, even having my localhost properly configured, I was still receiving a 404 because in my request header I wasn't sending the content type:
Content-Type:text/xml
After this first succesfull request, I was able to consume the api, and in the next requests, the content-type wasn't necesary,even if I didn't send the proper credentials, magento returns a 503, not a 404 like before.

You already answered to your problem, magento to access REST API, you got 404 url not found mostly link to missing to AllowOverride All in your apache config for the folder like as stated in https://magento.stackexchange.com/questions/29936/rest-api-returns-404
<Directory /var/www/html/magento/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Add your setting in /etc/apache2/apache2.conf

For anyone still getting the 404 after following all other advice, make sure that MultiViews isn't set in the Apache VirtualHost config.

Related

Shared Hosting proc_get_status has been disabled for security reasons

I'm trying to upload my laravel app to Cpanel. I set up everything right. It gives me the following error, though.
Please tell me how I can solve this problem?
proc_get_status() has been disabled for security reasons
Remove proc_get_status from php.ini's disabled functions in Cpanel
disable_functions = exec,execl,system,passthru,shell_exec,set_time_limit,escapeshellarg,escapeshellcmd,proc_close,ini_alter,proc_open,dl,popen,show_source,posix_getpwuid,getpwuid,posix_geteuid,posix_getegid,posix_getgrgid,open_basedir,safe_mode_include_dir,pcntl_exec,pcntl_fork,putenv,proc_get_status,proc_nice,proc_terminate,pclose,virtual,openlog,popen,pclose,virtual,openlog,escapeshellcmd,escapeshellarg,dl,show_source,symlink,eval,mail
Then override the config in Apache web server .htaccess
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/path/to/public_html
</IfModule>

CodeIgniter - 404 error after HTTPS configured

Helloooo,
I put HTTPS with letsencrypt and it works perfectly. The first page of my website is showing but after I click on a menu item, I got a 404 error.. I look into my controllers and everything is in.
Do you know any solution to this ?
Thank you :)
You need to set the AllowOverride directive in your apache configuration.
Change AllowOverride None to AllowOverride All
Set Allow Override

Remove context name from URL - mod_proxy_ajp with Spring Security

I have a app named "FitnessTracker" running on tomcat, post 8080. I am using Spring Security, and everything works fine when I test it directly on tomcat using http://localhost:8080/FitnessTracker
I then configured mod_proxy_ajp on Apache http 2.2, to access using a domain name, below is my VirtualHost configuration:
<VirtualHost *:80>
ServerName www.testing.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
RewriteEngine on
RewriteRule ^/FitnessTracker/(.*)$ /$1 [P]
ProxyPass / ajp://localhost:8009/FitnessTracker/
ProxyPassReverse / ajp://localhost:8009/FitnessTracker/
</VirtualHost>
Now, when I access www.testing.com/ - it gets redirected to www.testing.com/FitnessTracker/login.html
Is there a way to not have /FitnessTracker/ in the URL? I would like to hide the tomcat Context name from the URL.
Ideally, I want the URL to look like www.testing.com/login.html
I know that this is due to the RewriteRule, but without the rewrite rule spring security with mod_proxy doesn't work - since Spring security redirects to login page along with context name.
Please let me know if you have suggestions.
I think you forgot to rewrite the cookie domain and cookie path. Check ProxyPassReverseCookieDomain directive. From the backend perspective the request path still has to look like /FitnessTracker/

301 Redirect from subdomain to URL

I'm trying to set up a 301 redirect from a subdomain to a facebook page. I'm using this below and have uploaded it to the root folder on the server. I've also tried to upload this to the subfolder (example.com/blog), but to no avail...
RewriteEngine on
RewriteCond %{HTTP_HOST} ^blog.example.co.uk
RewriteRule ^(.*)$ http://www.facebook.com/example/$1 [R=301,L]
#Deny access to htaccess
Order Allow,Deny
Deny from all
Does anyone have any ideas why this isn't working?
Thanks in advance,
Ash
NOTE:
I've investigated this a little further and forgot to mention that the subdomain is set up on an old version of Drupal. This causes the site to fail when we set up any subdomain.
We can still navigate to the folder that the subdomain uses and the redirect works fine there.
So, the issue seems to be with drupal and subdomains, not the redirect.
Thanks,
Ash
What kind of error are you getting?
This bit of code would deny access to everything, not just .htaccess like it states in the comments...
#Deny access to htaccess
Order Allow,Deny
Deny from all

ISAPI Rewrite - Helicon /user to /page.asp?username=user

Im trying to rewrite my url from this :
http://www.somedomain.com/User
to
http://www.somedomain.com/somepage.asp?Username=User
Where the =User in URL 2 is the same as the /User in URL 1. It would be great if it doesnt just redirect, but do the change in the background.
Im using Helicon ISAPI_Rewrite ver 3.
Any help would be greatly appreciated.
It seems that to do a somedomain.com/user direction is possible, BUT it will mean that all requests will be send to your redirect, as somedomain.com/user and somedomain.com/page.asp will both be redirected. For this to work you will need to handle the requests to your redirect accordingly.
What I ended up doing, as this is MUCH less work, is to just redirect somedomain.com/user/username to the page I wanted to redirect to. the rule for this, looks like follow:
RewriteEngine Off
AllowOverride none
<VirtualHost somedomain.com>
RewriteEngine on
AllowOverride all
RewriteRule ^/user/(.*) /somepage.asp?UserName=$1
</VirtualHost>
Hope this helps someone.

Resources