magento backend url not working - .htaccess

I'm totally lost here, I have several Magento installations where the backend url doesn't work nice.
The problem is this:
In the frontend, all urls are perfectly rewritten so index.php is not in the url and mod_rewrite works.
but for the admin part, all urls that are created have the index.php part still in there, in a normal installation it wouldn't be a problem put now, a url like index.php/admin/dashboard results in a 404 error page. But, the funny part is that when I remove the index.php part of the url, it works.
I fixed this problem with a few .htacces tricks and hacks, but I find these hacks no good. Some parts of the backend still won't work or need their own .htacces redirect, or won't work at all even with the redirect in .htacces.
So, my questions are: Why are my Magento installations giving 404 errors on a index.php/admin call? And how to nicely get rid of the index.php part in the backend urls, without .htacces hacks?
The Magento version for all shops is 1.7.0.2

The solution is very simple, add "AcceptPathInfo On" to apache configuration.
Credits: http://www.magentocommerce.com/answers/discussion/178/index.phpinstall-was-not-found/p1

Related

Why can a url have 301 redirect-loops without any .htaccess rules

I have a redirect loop on my robots.txt file which keeps redirecting from https://www.URL.com/robots.txt to the same https://www.URL.com/robots.txt. The rest of the site - or at least what I observed so far - works perfectly fine.
In .htaccess we have some redirect rules for missing https or www in place, so at first I thought the reverse proxy might for example serve a wrong protocol, but that seems not the case. After playing around for a while, I simply did a mv .htaccess .htacc to completely disable all instructions. This causes all other pages to return 404 of course (page runs on wordpress), but the redirect loop on the .robots.txt still exists. I also added a query string ?a=b to the curl request URL to ensure uncached results and tried some online tools to verify the redirect as well. All with the same result.
The robots.txt won't spin up any of the php logic and the .htaccess is disabled, so I am wondering what might still cause the 301-loop?
The server runs on docker-containers with nginx, varnish, wordpress and mariadb.

Nginx URL rewrite to remove folder from URL when its followed by certain subfolders

After I have upgraded my site I see that once I go live with new version some parts of the website URLs will not be redirected for gallery, blogs and files because of new structure. And there is no way fixing it within the CMS. So my goal is to use NGINX redirects.
I wonder do any of you know any NGINX rewrite tricks to make such redirects possible?
website.com/forums/blogs/ into website.com/blogs/
website.com/forums/gallery/ into website.com/gallery/
website.com/forums/files/ into website.com/files/
I actually need the part forums dropped from the URL only and ONLY when the address is going for forums+blogs/gallery/files. Don't want to loose that google traffic.
So for example
website.com/forums/blogs/entry123/my-dog/ is redirected to
website.com/blogs/entry123/my-dog/
BUT
website.com/forums/topic/my-dog/
is left alone and working just like before because the following subfolder is neither blogs or gallery or files.
I needed that once on Apache and this one worked but on Nginx I have no idea.
RewriteRule ^forums/(blogs|gallery|files)/(.*)$ /$1/$2 [L,R=301]
You can try something like
rewrite ^/forums/(blogs|gallery|files)/(.*)$ /$1/$2;
Please note that rewrite directive accepts some flags wich meaning depends on where is it placed (is it inside a server or location block). Detailed documentation is here.

Dealing with Laravel routing without htaccess mod_rewrite capability

So, currently, I do not have the ability to utilize .htaccess, I have no control over the server config at the moment, so I have to live with /index.php/ in my URL. That's not a problem, but there is one issue.
If I go to webserver.com/site/index.php everything works fine. But, if I go to webserver.com/site/ (without index.php) the site loads but all the links are broken (relative to /site/ instead of /site/index.php/).
I've tried various ways to build the links with url() and route() but I can't get anything to work short of hard-coding the full url for every link.
Any ideas?

Strange 404 error - trying to avoid with .htaccess

I've got a fairly simple web site in which I trap any 404 errors and one that's started coming through is trying to access /home/sycamore/public_html/...valid url... instead of /...valid url...
Obviously /home/sycamore/public_html/ is the file path to where the site lives but firstly, how on earth is this request being generated. I can find nothing in my code that does anything like that and yet it is happening in just one area that;s been recently added. Any idea what can caused this?
In an attempt to avoid this I've added a rule to the .htaccess file so it now starts
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^/home/sycamore/public_html/(.*)$ /$1 [R,L]
However, this doesn't appear to do anything, I'm still getting the 404 reported on /home/sycamore/public_html/...valid url... although there are many other rewrite and redirect rules in .htaccess which work perfectly.
Any ideas as to (1) why the problem might be there in the first place and (2) why my htaccess attempt to 'correct' the url is failing?
I would also add that most of the requests for this URL are coming from search bots; google, yahoo, etc. and there is no mention of /home/... in the sitemap.xml file.
I'm pretty sure the original cause was down to some redirects in the htaccess file which were redirecting to a non-existent page and, I assume, causing it to generate this sort of error.
Still no idea why the attempted fix to rewrite the url didn't work but hopefully mending the htaccess file will have got rid of a lot of the problems (though there are still some unaccounted ones).

.htaccess rewrite base url for Wordpress

Ok sorry if this has been asked before but I could not find a working solution. I am using wordpress multisite. This is what I am trying to achieve.
Currently the domain http://mynew.com/ redirects (via my hosting co.) to one of the sites on my wordpress multisite installation as follows http://myold.com/subsite/
But I want to hide/swap the urls as follows, http://myold.com/subsite becomes http://mynew.com and all links that follow (eg. http://myold.com/subsite/another-link becomes http://mynew.com/another-link) without breaking.
I tried this in my .htaccess file which rewrote the url successfully however the links did not work and returned 404 errors.
RewriteRule ^subsite/(.+) http://mynew.com/$1 [R,L]
Hope that makes sense, thanks for your help.
Of course it will get you a 404 error, you redirected the request from the old site to the new site, but the new site does not contain the requested pages, so it through you a 404, what you need to do is to redirect from the new site back to the old site INTERNALY (that means without changing the browser address bar), but this requires your new site to work as a proxy server, see http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Resources