Try the Demo

Magento Forum

   
Rewrite seems not to work correctly
 
danielczyk
Jr. Member
 
Total Posts:  7
Joined:  2012-07-09
 

I have installed Magento 1.7.0.2 on windows without problems.

On Linux everything was installed, but several urls or rewrite rules seem not to work.

For example http://v2201207129188828.yourvserver.net/magento/api/rest/products gives me always “Invalid webservice adapter specified.”

This indicates, that the “RewriteRule ^api/rest api.php?type=rest [QSA,L]” does not work.

When I use “RewriteRule ^api api.php?type=rest [QSA,L]”, it works, but won’t help later in REST communication.

Another indication is:
http://v2201207129188828.yourvserver.net/magento/admin/oAuth_authorize?oauth_token=
leads to “Whoops, our bad...” - so no response or bad url somehow.

Has anybody a hint? So somehow it is related to the REST functionality.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagenX
Guru
 
Total Posts:  641
Joined:  2008-05-26
Dublin
 

have you tried to enable magento rewrites in admin? to remove /index.php/
have you configured rest api in magento admin?
do you have correct client settings to check this?

i just need more information.

 Signature 

MagenX - Magento and Nginx Performance Tuning Services
FPC InstallationMySQL TuningServer Optimizationnow 90 days Support included
http://www.magenx.com | | magento nginx config: http://nginxconfig.com || magento mysql settings -> my.cnf

 
Magento Community Magento Community
Magento Community
Magento Community
 
chicurel
Jr. Member
 
Total Posts:  5
Joined:  2011-02-22
 

Hi Daniel,
I’m having the same problem with Windows 7 and xampp Apache 2.2.21
Did you solve the problem?
I have the same configuration and data in Linux and is working fine. Maybe it’s an apache (windows) problem?

Thanks!

Diego

 
Magento Community Magento Community
Magento Community
Magento Community
 
chicurel
Jr. Member
 
Total Posts:  5
Joined:  2011-02-22
 

Hi, I have find the ‘problem’ !
It was hard to see but I think that maybe this is the same situation.
In apache included with xampp the configuration to virtualhosts inside the <Directory> tag include the option ‘MultiViews’ (!)
http://httpd.apache.org/docs/2.2/content-negotiation.html#multiviews
With this option the server try to match any name without extension to a file in the directory.
For example, if I put the url:
http://www.example.com/test

it will look for a file inside the folder with that name, and an extension knowed.
For example, test.php

This option precede the Rewrite conditions, so I had activated the rewrite log, and find that the url that was trying to match with the rewrite rule had ‘.php’ in the path.
I try with : http://www.example.com/api/rest
And in the log it was saying:
“strip per-dir prefix: C:/xampp/htdocs/api.php/rest -> api.php/rest” (look that is adding the .php extension because there is a api.php file in the folder)
“applying pattern ‘^api/rest’ to uri ‘api.php/rest’ “ So.. the rule don’t match!

Then, the solution to me was add the -MultiViews option in Directory configuration: “Options Indexes FollowSymLinks -MultiViews”
I put explicit -Multiviews because don’t know if it is defined in other place. With this, the api/rest redirection is working fine!
If you don’t want to deactivate the Multiviews option (why?) I think that you could moddify the rule (or add a new one) to match in this case. Something like :
RewriteRule ^api(\.php)?/rest api.php?type=rest [QSA,L]
This is wroking fine too.

I hope this could help someone in same situation.

Regards

Diego

 
Magento Community Magento Community
Magento Community
Magento Community
 
intelliant
Jr. Member
 
Total Posts:  1
Joined:  2013-02-06
 

@chicurel

Have diagnosed and found that the value of “type” not being passed on the api.php is consistent with what has been found above as well as others in the posts below.

You seemed to have nailed this issue pretty well but I am yet grappling with it. have read and tried almost everything given in these links:
http://www.magentocommerce.com/boards/viewthread/288422/
http://www.magentocommerce.com/boards/viewthread/288718/#t414474
http://www.magentocommerce.com/boards/viewthread/279715/

I say almost as I am unable to get the Rewrite log written for debugging purposes. Have ensured that mod_rewrite is loaded. And this is how the /etc/apache2/conf.d/rewrite looks -

RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 3
but there is no sign of any log.

Additionally -

Firefox REST client’s GET requests are always returned XML and it returns the

406 Not Acceptable
response when we explicitly specify
Acceptapplication/json
in the FF REST client

CURL -

curl -X GET http://<base_url>/magento/api/rest/products
is always returned JSON and again returns the
406 Not Acceptable
response when we specify any Accept header.

Please do let me know if I can furnish any further information that shall help us resolve this.

Any help in this regard will be much appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
adrianalexan
Jr. Member
 
Total Posts:  3
Joined:  2012-11-11
 

This seems indeed to be a bug at least in 1.7.0.2 version. I’m really looking forward to see this officially reported.
So far the “workaround” is to use the XML delivered version.
I’ve seen this problem on ubuntu-12.04.2 (x32); on ubuntu-12.10-server-amd64, there are even more issues: the api cannot even be enabled.

 
Magento Community Magento Community
Magento Community
Magento Community
 
GoMageTeam
Sr. Member
 
Avatar
Total Posts:  151
Joined:  2013-01-13
Warsaw, Poland
 

Hello,

It seems that mod_rewrite is disabled. It can be enabled via the next command in Linux:
sudo a2enmod rewrite
In Windows you should open the configurable file Apache(httpd.conf) and find the line:
LoadModule rewrite_module modules/mod_rewrite.so
Then you should uncomment it. After these actions you should reload Apache.
You can get more information here:
http://www.magentocommerce.com/boards/viewreply/427178/

 Signature 

Bronze Partner of Magento
• A high-leveled development company – Providing easy, comfortable and useful Magento extensions
• The supporters of qualified and fast service. Find out more here: http://www.gomage.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
adrianalexan
Jr. Member
 
Total Posts:  3
Joined:  2012-11-11
 
GoMageTeam - 27 February 2013 02:44 AM

Hello,

It seems that mod_rewrite is disabled. It can be enabled via the next command in Linux:
sudo a2enmod rewrite
In Windows you should open the configurable file Apache(httpd.conf) and find the line:
LoadModule rewrite_module modules/mod_rewrite.so
Then you should uncomment it. After these actions you should reload Apache.
You can get more information here:
http://www.magentocommerce.com/boards/viewreply/427178/

Sorry, this is not the case, at least in my situation smile
I heavily rely on rewrites for SEO…

 
Magento Community Magento Community
Magento Community
Magento Community
 
janirx
Jr. Member
 
Total Posts:  1
Joined:  2013-03-23
 
adrianalexan - 16 February 2013 01:47 PM

This seems indeed to be a bug at least in 1.7.0.2 version. I’m really looking forward to see this officially reported.
So far the “workaround” is to use the XML delivered version.
I’ve seen this problem on ubuntu-12.04.2 (x32); on ubuntu-12.10-server-amd64, there are even more issues: the api cannot even be enabled.

If someone still has problems with this, I had the same problem and found out that the Accept header must include */*;q=0.8 in addition to application/json for it to work. Otherwise magento gets a fit and gives 406.

So header:
Accept: application/json,*/*;q=0.8

I suppose quality parameter can be anything < 1.

That’s why you get xml when not specifying Accept header since standard header includes application/xml

Hope this helps someone.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top