Magento Godaddy No file input specified - magento

I have Linux webhosting on Godaddy. I tried installing Magento CE 1.8 on subdomain for more than a week and I still cannot get it to work.
Before you say this question is duplicit, I have tried everything I found on Magento Wiki, Forums, Google and Godaddy forum and support and I still cannot get it to work.
For php5.ini I take Magento php.ini.sample, .htaccess is from Magento too.
Using Options -MultiViews in .htaccess usually doesn't do anything.
Settings cgi.fix_pathinfo = 1 in php5.ini creates cyclic redirect.
I have tried playing with RewriteBase in .htaccess and that didnt help either.
I read that Magento doesnt run on fcgi, so I use in my .htaccess, doesnt help either:
Options +ExecCGI
addhandler x-httpd-php5-cgi .php
I always end up with "No file input specified" or cyclic redirect or server error.
Only lines in error log that I see are added:
[Thu Oct 31 01:23:08 2013] [11988011] [negotiation:error] [client 5.178.58.85:65433] AH00687: Negotiation: discovered file(s) matching request: "path" (None could be negotiated).
But I dont know what that does mean or how to fix that.
So is there anything else I can try or am I missing something? I know Magento on Godaddy shared hosting isnt a good idea, but I need to get there my development running and production will run on my clients Dedicated server.

Add this to your .htaccess file and forgot those other fixes....
RewriteRule ^index.php/(.*)$ [L]

If magento lies in a subdirectory then use:
RewriteRule ^index.php/admin(.*) {RewriteBase}/admin$1 [L]

So I managed to solve it after few weeks of trying different solutions on net and trying to get support to help me.
Nothing helped solve it so I tried myself and found out that the problem is "index.php" in url. So I have created simple php function which is run in at the beginning of index.php file. This function removes "index.php/" from url and redirects to this new url.
Also to remove "index.php" from form actions and other places where the url might show up, it is good to create your own router module or modify Magentos router.
Now it all works.
PS:
I have also kept other fixes in place:
In .htaccess:
Options +ExecCGI
AddHandler x-httpd-php5-cgi .php
AddHandler x-httpd-php5-cgi .php5
Options -MultiViews
RewriteBase /
And in php5.ini
cgi.fix_pathinfo = 1
EDIT
What I wrote does work, but is not good solution, redirect in index.php loses all POST data ofcourse. And looking at Magento and changing router takes too much work, so in the end I managed to create working rule in .htaccess for admin. Just put it as last rewrite rule in your .htaccess:
RewriteRule ^index.php/admin(.*) /admin$1 [L]
EDIT
Forgot to write here, that I have changed the rewrite to this:
RewriteRule ^index.php/(.*) /$1 [L]

Related

icons not showing up in firefox without "www." before domain

I'm using OpenCart for my site. The icons fail to appear when you visit example.com but they do appear if you visit www.example.com.
Any ideas what is going on here?
I have just edited config.php file and removed www. and it works for naked domain but the icons do not load
// HTTP
define('HTTP_SERVER', 'http://example.com');
define('HTTP_CATALOG', 'http://example.com');
define('HTTP_IMAGE', 'http://example.com/image');
define('HTTP_ADMIN', 'http://example.com/admin');
I would redirect all non www traffic to www. This should take care of your issue with icons. It'll also prevent possible SEO issues as a result of duplicate content/pages.
If you have an apache server add a redirect to your .htaccess.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
What worked for me:
Go into the config.php file (please backup your file first) in the main directory of your OpenCart installation.
Under //HTTP (lines 5-8 for me), edit
lines:
define('HTTP_SERVER', 'http://example.com/shop/');
define('HTTP_CATALOG', 'http://example.com/shop/');
define('HTTP_IMAGE', 'http://example.com/shop/image/');
define('HTTP_ADMIN', 'http://example.com/shop/admin/');
to read:
define('HTTP_SERVER', '/shop/');
define('HTTP_CATALOG', '/shop/');
define('HTTP_IMAGE', '/shop/image/');
define('HTTP_ADMIN', '/shop/admin/');
.
Depending on your installation, I'm sure this could cause some problem somewhere I just haven't found it... yet... (maybe someone else could correct me -- I really don't mind; I like to learn).
This worked for me:
Add to .htaccess file this line: Header add Access-Control-Allow-Origin "your-domain.com"
Change "your-domain.com" required by the url.
If in our configuration file use: define ('HTTP_SERVER' 'http://example.com/);
Then place: Header add Access-Control-Allow-Origin "http://www.example.com/"
I tested this in opencart 2.0.

ModRewrite .htaccess / SEO URLs syntax

I am trying to re-use some .htaccess code on a new site/server and it doesn't work correctly. I'm not an expert with URL rewriting so would appreciate it if anyone can see if my syntax is incorrect or if there is something else I need to check server side.
I am using the following code:
Options +FollowSymLinks
RewriteEngine on
# News Pages
RewriteRule ^news/$ /news.php
RewriteRule ^news/(.*?)/$ /news.php?article=$1
It works for the 1st level, /news/ but /news/article-1/ just loads the /news/ (news.php) overview page. /news.php?article=article-1 works correctly.
Server is running Apache 2.2.9 and PHP is in CGI mode.
Try it such way:
RewriteRule ^news/(.*?)/?$ /news.php?article=$1 [L]
RewriteRule ^news/?$ /news.php [L]
[L] in the end of instruction stops server cheacking of other instructions, if current one match.
So you write more specific ahead of more general.
If your rules work correctly being the only one in the .htaccess, then such organisation of them can help.
/? - this means that / at the end can absent or present

mod_rewrite - rule redirects when redirect not wanted

I have the following:
# Enable Redirects
RewriteEngine On
RewriteBase /
Options +FollowSymlinks
Options -Indexes
RewriteRule ^sitemap\.xml$ http://%{HTTP_HOST}/index.php?route=feed/google_sitemap [L,NC]
From what I've read it should just internally rewrite sitemap.xml to http://%{HTTP_HOST}/index.php?route=feed/google_sitemap and not do any redirecting (i.e. changing the URL in the browser), but it is doing and I don't want that.
Can someone point out why please?
I've tried removing the L flag, thinking maybe it's to do with the characters in the URL?
Actually, if I'm not mistaken, mod_rewrite redirects upon getting served with a http-link. What happens if you remove http://%{HTTP_HOST}/? Try it out, and let us know what happens!

how can I get my mod_rewrite to work?

I took a look around at other mod_rewrite questions and couldnt come up with an answer, so if anyone would point me to one that I may be duplicating I would appreciate it.
Anyways my question is: Why is my mod rewrite not working? I followed like 3 tutorials and spent a while reading forums and previous questions on this site, and couldnt get any of them to work. Ive tried doing it through my vhosts.conf file (I think its also known as the httpd.conf on some installations of linux) and through a .htaccess
Here is my .htaccess filed code
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^/article/([0-9]+)$ article.php?art_id=$1 [NC,L]
Here is the link im trying to get working: mysite.com/article?art_id=$1
To be honest I only have a slight clue as to how mod_rewrite works.
I have mod_rewrite installed (I don't manage the server, but the company I work for also has hosting services, thats how I have access to the vhosts.conf but I did not set the server up, and as far as I know the guy doing it is pro and set it up right)
I put this in to see if I could get it to work and it redirected me to my home page (I think that means its working)
# Options +FollowSymLinks
RewriteEngine on
RewriteRule ^fakepage\.html$ http://yoursite.com/ [R,L]
At least as far as your .htaccess file goes, using the rule you have will not work because the input to the RewriteRule will never have an initial forward slash on it. The rule should instead look more like this:
RewriteRule ^article/([0-9]+)$ article.php?art_id=$1 [NC,L]
However, what you have should have worked when you tried it in a virtual host (assuming you restarted the server), so I'm not sure if this is the actual issue. In what way is the rewrite not working? Are you getting 404 errors instead of being redirected to the file you were expecting?
Tim is correct about the slash at the beginning of your RewriteRule.
When trying to figure out Rewrites, it can be helpful to turn on logging:
RewriteLog "/var/www/mysite.com/rewrite.log"
RewriteLogLevel 9

using mod_rewrite to redirect from subdomain to maindomain

My problem is that i have a functioning subdomain (sub.mydomain.com). sub is loaded in mydomain.com/sub.
What i would like to do is to redirect all requests to sub.mydomain.com to mydomain.com.
Somehow it seems that when im the subdomain i cannot access the rootfolder (main domain). I can get it working with from mydomain.com/sub to mydomain.com. But not from the subdomain.
Currently im using:
RewriteEngine on
RewriteRule ^(.*)/?$ /home/web/webuser/$1 [L]
When accessing sub.mydomain.com i get a 500 Internal Server Error.
Is there a restriction in accessing the main from a sub? (rights wise)
Or maybe another way of getting to main, perhaps something like (../$1)
Thanks
EDIT:
I only have access to .htaccess. So DocumentRoot cannot AFAIK be used in .htaccess file.
What about symlinks? I dont really know what it does, but i assume that it links two locations? The only code i found for that enables symlinks (Options +FollowSymlinks) - but this line doesnt say anything about what to link (perhaps im all wrong)
Btw. thanks for input so far !
I must admit that I did not fully understand your question. Do you want to redirect everything from sub.mydomain.com/whatever to mydomain.com/whatever? In that case, the following (put in the config file of your sub.mydomain.com) might work:
RewriteEngine On
RewriteRule ^/(.*)$ http://mydomain.com/$1 [R,L]
It redirects on the client side, meaning that the user will see mydomain.com/sub in the browser.
EDIT: I think I understand your question now. Yes, it's a permissions issue: If the DocumentRoot of your web site is /whatever/sub, then you cannot just access /whatever by adding "/.." to the URL. I hope you understand that this is a good thing. :-) mod_rewrite just changes the URL, so it cannot do that either.
So, to solve your problem, you need to either change the DocumentRoot of sub.mydomain.com or create a symlink that allows you to access the required directory (e.g. /whatever/sub/redir-target -> /whatever). Be careful with the symlink option, though, since it will create valid directories of infinite length on your file system (/whatever/sub/redir-target/sub/redir-target/...) and some scripts cannot cope with that.
EDIT2: Instead of a symlink, you might want to create an alias, e.g., something like this:
Alias /redir-target /home/web/webuser
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/redir-target/.*$
RewriteRule ^/(.*)$ /redir-target/$1
Still, I think the easiest solution is to change the DocumentRoot...
Why not try using a Redirect Directive from mod_alias?
It's difficult to provide a definitive answer without knowing more about your server configuration.
The following might work and is at the very least a decent starting point:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sub\.mydomain\.com
RewriteRule (.*) /$1 [L]
Ideally that would go in your httpd.conf, but might work from a .htaccess file (again, more information about how your subdomains are setup would be helpful).

Resources