How do i fix these wrong URL's in my broken magento deployment? - magento

This is my first attempt at using Magento to develop a site. I have to admit the learning curve has been steep, but i have been able to navigate most of the challenges thus far. Here at the final hurdle, however, i have stumbled.
Specs:
Magento 1.7.0.2
Apache version 2.2.22
PHP version 5.3.10
MySQL version 5.1.65-cll
Magento is located in a folder on the server named magento one directory down, as in http://www.mydomain.co.za/magento
Problem:
No images are displayed in the front end or backend. It is as if it cannot access the stylesheets. When viewing the source, i can see that the paths are wrong. It searches for the stylesheets in http://www.mydomain.co.za/ and not in the magento folder. I can access the backend by typing in http://www.mydomain.co.za/magento/index.php/admin and that brings up the backend without any styling. After that however, every request results in 404. The URL looks like http://www.mydomain.co.za/magento/adminindex.php without a slash between admin and index. Introducing that slash manually after every 404 results in correct page being displayed (still without styling). So clearly the problem is here, but i can't seem to fix it. And YES, i do have the slash after the path in the database for both secure and unsecure.
Attempts to solve:
Changed the url’s in database link
Changed app/etc/local.xml to use correct database
Changed .htaccess to include this line: RewriteBase /magento/ (but i
removed it again)
Deleted the appropriate cache and sessions folders
Tried some of the suggestion given here link
Now, i am stuck. I have worked my way through error upon error (no fault of Magento, just the learning curve) and i am tired… :-( If someone can please give me some advice as to what to try next, it would be greatly appreciated.
I found these links of the (seemingly) similar problem. Clearly there is something happening here. The other thread never solved the issued, just found a work around. Is it possible that we have run into a bug? Something is stripping that slash out and it isn’t any of the usual suspects… dum dum dum
link
link

Related

Magento Admin URL 404

I know that that similar issues and topics exist, however my issue differs slightly and none of the proposed fixes have worked.
I was accessing the Magento backend as normal. Approximately 10 minutes after that I could no longer access the Magento backend.
What I mean is that when I go to the admin url login page, I get a 404. However the 404 isn't generated by my host, it's generated by my webstore.
Everything about my webstore works as normal.
I've seen a number of fixes, mainly this one...
http://www.magentocommerce.com/boards/viewthread/207981/#t274443
I have a few main issues.
Admin Custom URL had been set (but not by me). It was set over a year ago when Magento was installed. It worked entirely fine until today.
I do not even have "admin/url/custom" and "admin/url/use_custom" in my "core_config_data" PHP table. It simply does not exist so I cannot change it. I looked manually for it and did a search for it. Nothing.
I tried updating the local.xml file and clearing "var/caches" and "var/sessions" but that did not work either.
I've been working this for hours and it's beyond frustrating. It's imperative that this be fixed ASAP because we are a fairly sizeable company.
Thanks ahead for helping. Anything at all would be appreciated.
First Check your Apache configurations
I know that you said you were only in the Magento admin but I would first check that apache was configured correctly. This is the first point of contact and you need to ensure that it's working right.
You need to locate a default Magento htaccess file that you can upload to your server. There's additional configurations that you need to make if you're in a subdirectory and also check to make sure that your mod_rewrite is working properly. There's an extensive tutorial on these things here, magento htaccess.
Make sure that you have the right magento admin url
I have to assume that you know what your magento admin url is, but of course I would double check that you're getting it right. There is an option in the admin area to change the admin url, you could have adjusted that on accident.
You say that you don't have "admin/url/custom" and "admin/url/use_custom" in your core_config_data table. This actually means that you didn't set the magento admin url from the admin area. However there is a third place that you can look for your admin url. This is in app/etc/local.xml but you couldn't have changed this from the administration area.
Did you turn off search engine friendly urls?
If you had been accessing your administrative area using /admin and then accidentally turned off SEF urls, then your admin area could have just simply moved to /index.php/admin. Of course you mentioned that you have a custom admin url, but I don't know what that is, so I'm giving examples with the default.
I can't really give you any more suggestions without more information. I hope that this helps!
Found this and thought I would post here since it shows up in google.
http://sourcelibrary.org/2011/05/19/magento-404-page-not-found-error-for-admin-panel-access/#comment-8444

Magento gives 404 on every page, including homepage

I have just followed the following steps for a Magento migration.
Copied all fiels from our staging server to the production server
Dumped the database and copied it to the production server
Imported database dump into new database
Updated app/etc/local.xml
Updated the database entries "web/secure/base_ur" and "web/unsecure/base_url" to the new url
Cleared var/cache
Now each page gives a 404 error, including the homepage and admin. Also, it does not seem to be a htaccess problem because urls with index.php in the path also don't work.
I have done the same procedure as listed about on my a different machine with the same files, and then it works fine. So it seems server specific.
I have done extensive searching on the problem, but nothing seems to help so far.
Any ideas are greatly appriciated!
--edit--
I somewhat fixed it.
In index.php I changed:
Mage::run($mageRunCode, $mageRunType);
To
Mage::run('english');
This seems to be necessary as english is the name of our default store. However, I think it would be better if Magento figures this out by itself. Also, how come this worked out of the box when migrating to another server?

Magento: ?___SID=U appearing in some urls

Can someone please explain why ?___SID=U is appearing in some Magento URLs on my site and not others?
I think it has something to do with sessions but I am not entirely clear. Also, what makes it more confusing is the fact that it's only appearing in some URLs and not others.
I don't need to know how to remove it as I am aware of the setting in the admin area. I would really like an explanation of what it is, what its purpose is and why it would show on some pages and not others. id rather understand what's going on fully than blindly follow some advice as to how to remove it.
I addition to Brendan's answer, the ___SID=U is used in the cache as a placeholder for the session ID. It is replaced by Mage_Core_Model_Url::sessionUrlVar() which in turn calls Mage_Core_Model_Url::sessionVarCallback(). These methods are called from Mage_Core_Block_Abstract::_afterCacheUrl(), which means that any URL found in block output will contain the correct session ID (if needed).
So to get rid of the parameter in your own code the "right way" use this:
$url = Mage::getUrl('some/magento/route'); // might append ___SID parameter
$url = Mage::getModel('core/url')->sessionUrlVar($url); // process ___SID
If the string still displays in the rendered page that is a bug. Are you using some custom caching module, or generating URL's using a non-standard way?
The SID is a "session ID". Magento uses this to track a user's activity within the same Magento installation. Normally, Magento powers one website and one store from one installation (database).
Magento could power multiple websites with multiple stores from one installation though. The SID allows users to stay logged in while navigating across these websites/stores.
I think if you have the function enabled, the SID is sent when accessing catalog URLs so Magento can update the session with the user's location/state for the current website/store.
If you're not running a multi-website or multi-store environment, it's safe to disable the SID on the frontend.
Just something i come across today and though i make a comment, maybe it will help someone.
I found that Magento will format/create an incorrect product url (inc. Session Id) if there were some errors during processing the page. This is not consistent though.
It worth having a look at your server logs for PHP errors.
This is a general Magento 2 bug which is already reported to magento.
Temporary fix is
Go to Document Root,
Find .htaccess and add
RewriteCond %{HTTP_HOST} ^abc.com
RewriteRule ^(.*) www.abc.com/$1 [L,R=301]
below.
This should solve the issue. For me this work in M2.1
All the best.
Reference : https://github.com/magento/magento2/issues/5517
I hunted for hours to find this and the precise answer was a combination of the other answers listed here. First, I cranked up my PHP error reporting and error logging (thanks Gergely Varga). I saw this:
PHP Fatal error: Call to undefined function mb_strrpos() in /var/www/html/app/code/local/ManaPro/FilterAjax/Model/Observer.php on line 59
So, one of our installed extensions requires the php-mbstring package, which my server didn't have installed. As soon as I installed that, the SID=U URLs all disappeared. (In future I'll be running Magento's pre-install checks before copying an existing install over to a new server!)
Thanks to Vinai too for the background of what this tag is for.
Go to Store > Configuration > General > Web > Session Validation Settings > Use SID on Storefrontand and set the value to No.
Clear the Magento cache

How to solve 404 not found problem in Magento

I have installed full release Magento on localhost from http://www.magentocommerce.com/download. Before doing installation I have created a database and import Magento sample database (downloaded from Magento site).
After that continue installation process. When I checked fronted its shows Best Selling Products when I clicked any of the product it gives error given below:
Whoops, our bad...
The page you requested was not found, and we have a fine guess why.
* If you typed the URL directly, please make sure the spelling is correct.
* If you clicked on a link to get here, the link is outdated.
What can you do?
Have no fear, help is near! There are many ways you can get back on track with Magento Demo Store.
* Go back to the previous page.
* Use the search bar at the top of the page to search for your products.
* Follow these links to get you back on track!
Store Home
My Account
I am new to Magento.
I've experienced this too. In the admin go to System > Index Management and rebuild the various catalog indexes, especially the URL rewrites.
This is because the sample data doesn't have it's paths stored to begin with, it needs to be calculated, and the Best Selling Products section doesn't read the actual paths in use, instead it is a Static CMS Block with it's HREFs fixed. This will probably never occur for products you enter yourself so it's nothing to worry about.
I had the same problem in Wamp. I had my folder named Magento, renaming it to magento, fixed the problem. (Lower case)
I had a similar issue, I was transferring Magento from a Unix server to a Windows server. My issue was to do with links looking like this (not working)
http://www.magentoshop.com.au/shop/product01.html
instead of
http://www.magentoshop.com.au/shop/index.php/product01.html
Haven't worked out how to fix all links yet, but just adding it tells me where the issue lies. Hope it helps someone else.

URL Rewrite with Joomla on IIS7

I have Joomla 1.5.9 running on IIS7. I'm now experimenting with the SEO Settings from the Joomla global configuration page.
First I toyed with Search Engine Friendly URLs (that gets rid of the queries part of URLs); that works fine.
I also tried to enable the "Use Apache mod_rewrite". I installed "Microsoft URL Rewrite Module for IIS 7.0" and added the web.config as per http://learn.iis.net/page.aspx/527/joomla-on-iis . When clicking on menu links, this seems to work in that I no longer see index.php in the URL. The address bar updates to what appears like the right URL, but the content shown is always that of the home page. I tried both in IE and Google Chrome with the same result. Refreshing the page after loaded made no difference.
I tried re-starting IIS7, it didn't make a difference.
Edit: After I followed the suggestion below (followed instructions at http://www.mydotnetworld.com/post/2008/10/24/URL-Rewriting-In-Joomla-15-on-IIS-7.aspx :turned on fast cgi, modified php.ini, and imported rewrite rules instead of putting them in a web.config myself), I now get 404's instead of just showing the home page's content. The URL still appears to be correctly rewritten. So, different behavior but still doesn't work. I'm not sure this is useful information, but these two fields are shown in the 404 page:
Requested URL http://localhost:80/joomla_course/seasonal-specialties
Physical Path C:\inetpub\wwwroot\joomla_course\seasonal-specialties
Should the physical path be the 'non-rewritten' URL? Or is it expected that that it be like this?
Edit 2: Oho! I found someone with the same issue posted on Joomla forums: http://forum.joomla.org/viewtopic.php?f=543&t=364706&p=1598137#p1598137 . No answer there either, though.
Any idea on how to diagnose (or even better, fix :) ) this?
Thanks!
I got this to work now. The key was to make sure FastCGI is used to run php (as per http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70 ), and making sure that the "Use Apache mod_rewrite" is enabled. If "Use Apache mod_rewrite" is turned off but the rewrite rules are present in IIS7, then the HTML shows up but none of the styling or images.
The requirement for using FastCGI is weird (and contradicts what is suggested in http://maximumpcguides.com/windows-vista/how-to-create-a-windows-vista-iis7-mysql-php-web-server , which is what I used to setup php in the first place). Everything seems to work when not using FastCGI, except for the URL rewriting.
It seems that either importing the rules (as suggested in http://www.mydotnetworld.com/post/2008/10/24/URL-Rewriting-In-Joomla-15-on-IIS-7.aspx) or manually adding them to a web.config file (as suggested in http://learn.iis.net/page.aspx/527/joomla-on-iis ) will work.
It looks like there is something wrong with the rules in the web.config. Just going from a comment on the article you linked you are not the only one having this issue. I would remove the web.config and then follow the steps outlined here.

Resources