Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Missing Slash On Category Urls
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

Sorry if this has been answered elsewhere, but I couldn’t find the answer. Whenever I create a category and click on it in the header navigation it goes to a blank page. If I put a slash after the url, it work fine. This is the case if I define the SEF URL or leave blank. For instance if I create a category called Books, it shows up in the navigation and when I click the link it takes me to http://mydomain.com/books - which doesn’t do anything.

If I manually change this to http://mydomain.com/books/ - everything works fine. Like I said, this is the case if I define the SEF URL as well. Any help getting this sorted out is greatly appreciated.

Thanks,
Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@dan_w: I can’t reproduce this problem.

Anyone else experiencing this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
dumdesifob
Jr. Member
 
Total Posts:  1
Joined:  2008-04-19
 

I’m getting this EXACT problem. Does anyone know how to fix this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Crucial
Enthusiast
 
Avatar
Total Posts:  770
Joined:  2007-11-07
Phoenix, AZ
 

This has bothered me in Magento actually. I really don’t like when a URL doesn’t end in a forward slash. Even browsers (and Apache) will force a forward slash. The only time you don’t need a forward slash, is when you’re dealing with an actual file, e.g.:

http://www.domain.com/file.php

Compared to…

http://www.domain.com/directory/

It’s a simple fix really. Open up the .htaccess file in the magento directory and add the following anywhere after the RewriteEngine On part.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.domain.com/$1/ [R=301,L]

Replace the URL on the last line with your domain name. That should do the trick.

Basically, all that’s doing is everytime a request is made, if it isn’t for a file (because files shouldn’t end in a forward slash), it will add a forward slash. You can see more .htaccess tricks on our blog URL:

http://www.crucialwebhost.com/blog/htaccess-apache-rewrites-oh-my/

Oh, and one more thing, your host might actually have the DirectorySlash directive turned off. You could also try this instead of the above:

DirectorySlash On

That can be placed anywhere in the .htaccess file.

 
Magento Community Magento Community
Magento Community
Magento Community
 
itchytrig
Sr. Member
 
Avatar
Total Posts:  162
Joined:  2008-10-03
UK
 

Hi,

On a simular note, we want to provide what we call ‘quick links’ on the first level navigation, so we can use say:

http://www.yourcompany.com/accessories

Where Accessories would be the first level of the navigation tree, in Magento. However, at present Magento adds a .html to the above, so the above URL would not work.

Can the .htaccess be changed to work around this at all? Can Magento handle such a request or is there a module out there that offers this level of change? Allows for better offline / online advertising, when you want to direct traffic directly to a certain part of your store. I would be surprised if Magento had not got this covered somewhere already!

Ideally, we would like to then store say:

http://www.yourcompanyname.com/quicklink

to link to (perhaps a 301 redirect) to

http://www.yourcompanyname.com/catalogsearch/result/?q=whateveryouwanttosearchfor

I know we can do this manually in the .htaccess file, but would be better if Magento could handle all this from the admin.

Welcome others thoughts, work arounds, ideas on this!

wink

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