Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

redirect - htaccess


bksbeat

Recommended Posts

If you check out my site www.nontando.com you have index.php appearing in the url for all categories. I would like to get rid of that so that, instead of, eg.

 

http://www.nontando.com/index.php/ceramics-c-67

 

rather have

 

http://www.nontando.com/ceramics-c-67

 

 

My htaccess currently appears as follows:

 

$Id: .htaccess,v 1.3 2003/06/12 10:53:20 hpdl Exp $
#
# This is used with Apache WebServers
#
# For this to work, you must include the parameter 'Options' to
# the AllowOverride configuration
#
# Example:
#
# <Directory "/usr/local/apache/htdocs">
#   AllowOverride Options
# </Directory>
#
# 'All' with also work. (This configuration is in the
# apache/conf/httpd.conf file)
# The following makes adjustments to the SSL protocol for Internet
# Explorer browsers
<IfModule mod_setenvif.c>
 <IfDefine SSL>
   SetEnvIf User-Agent ".*MSIE.*" \
		 nokeepalive ssl-unclean-shutdown \
		 downgrade-1.0 force-response-1.0
 </IfDefine>
</IfModule>
# If Search Engine Friendly URLs do not work, try enabling the
# following Apache configuration parameter
#
# AcceptPathInfo On
# Fix certain PHP values
# (commented out by default to prevent errors occuring on certain
# servers)
#
#<IfModule mod_php4.c>
#  php_value session.use_trans_sid 0
#  php_value register_globals 1
#</IfModule>
RewriteEngine on
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteCond %{HTTP_HOST} ^nontando.com [NC]
RewriteRule ^(.*)$ http://www.nontando.com/$1 [R=301,L]

 

Any advice would be much appreciated

Regards, Gary

Link to comment
Share on other sites

What are you using for SEO add-ons? I don't see anything in that .htaccess that looks like it deals with the "ceramics-c-67" and changes it into the appropriate URL Query String for index.php. Once we know that, we can consider modifying the SEO code to omit "index.php" from generated URLs.

Link to comment
Share on other sites

Hi Phil,

 

I had installed SEO URL5 a few years ago.

This is my settings:

 

 

 

Value Action Enable SEO URLs 5? true icon_arrow_right.gif Enable the cache? true icon_info.gif Enable multi language support? false icon_info.gif Output W3C valid URLs? true icon_info.gif Select your chosen cache system? mysql icon_info.gif Set the number of days to store the cache. 7 icon_info.gif Choose the uri format standard icon_info.gif Choose how your product link text is made up p icon_info.gif Filter Short Words 3 icon_info.gif Add category parent to beginning of category uris? false icon_info.gif Remove all non-alphanumeric characters? false icon_info.gif Add cPath to product URLs? false icon_info.gif Enter special character conversions. (Better to use the file icon_info.gif Turn performance reporting on true/false. false icon_info.gif Turn variable reporting on true/false. false icon_info.gif Force www.mysite.com/ when www.mysite.com/index.php true icon_info.gif Reset USU5 Cache icon_info.gif Enable SEO URLs 5?

Link to comment
Share on other sites

Hi Gary,

 

I'm very new to all this, but I have recently been researching SEO URL5.

You need to do 2 things:

1. Change the uri format from standard to rewrite.

2. In the SEO URL5 documentation, there is a htaccess.txt file. You need to copy and paste the content of this file into your .htaccess file. You also have to make a mod depending on your site structure. It is all fully explained in the docs.

 

Good luck!

Link to comment
Share on other sites

Is the SEO working properly, and you just want to get rid of "index.php"? I'm confused -- did you show the right .htaccess file? As I said, I see nothing in there to convert it to the standard UQS form.

 

Update: I have no experience with this particular add-on, so someone familiar with it should lead you through it. I can't tell you about the configuration part, but if you want to show the .htaccess file before and after, we could figure out what went wrong when you edited it. If this is a 500 (Internal Server) error caused by the edited .htaccess file, most likely it's a syntax error in the code, or possibly blank lines at beginning or end.

Link to comment
Share on other sites

Yes I showed the right htaccess file

Yes the SEO is working properly.

Yes, ALL I am trying to do is get rid of the index.php from the url

The 500 Internal Server happens when I change the admin settings for the SEO from standard to rewrite

When I add the code into htaccess as per the add-on, I get page not found.

I had sent you my details - I dont see anythng wrong with the htaccess fle from my end

# $Id: .htaccess,v 1.3 2003/06/12 10:53:20 hpdl Exp $
#
# This is used with Apache WebServers
#
# For this to work, you must include the parameter 'Options' to
# the AllowOverride configuration
#
# Example:
#
# <Directory "/usr/local/apache/htdocs">
#   AllowOverride Options
# </Directory>
#
# 'All' with also work. (This configuration is in the
# apache/conf/httpd.conf file)
# The following makes adjustments to the SSL protocol for Internet
# Explorer browsers
<IfModule mod_setenvif.c>
 <IfDefine SSL>
   SetEnvIf User-Agent ".*MSIE.*" \
		 nokeepalive ssl-unclean-shutdown \
		 downgrade-1.0 force-response-1.0
 </IfDefine>
</IfModule>
# If Search Engine Friendly URLs do not work, try enabling the
# following Apache configuration parameter
#
# AcceptPathInfo On
# Fix certain PHP values
# (commented out by default to prevent errors occuring on certain
# servers)
#
#<IfModule mod_php4.c>
#  php_value session.use_trans_sid 0
#  php_value register_globals 1
#</IfModule>
RewriteEngine on
#unless directory, remove trailing slash
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)/$ $1 [R=301,L]
#redirect external .php requests to extensionless url
#RewriteCond %{THE_REQUEST} ^(.*)\.php([#?][^\ ]*)?\ HTTP/
#RewriteRule ^(.*)\.php$ $1 [R=301,L]
#resolve .php file for extensionless php urls
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ /$1.php [L]

RewriteCond %{HTTP_HOST} ^nontando.com [NC]
RewriteRule ^(.*)$ http://www.nontando.com/$1 [R=301,L]

Header set X-UA-Compatible "IE=8"

Link to comment
Share on other sites

The use of index.php in the url like that is how SEO 5 is written. I don't think you can remove it without editing the code but that is a question that should be asked in its support thread. Your .htaccess file is missing a rewritebase statement. I don't use SEO 5 and may be incorrect on that but I think you need it. Again, best answers are usually obtained in the addons support thread since that is where the author and people that use it are most likely to see it.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I have added this code to htaccess

 

RewriteRule ^([a-z0-9-/]+)-p-([0-9]+).html$ product_info.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-c-([0-9_]+).html$ index.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-m-([0-9]+).html$ index.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-pi-([0-9]+).html$ popup_image.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-pr-([0-9]+).html$ product_reviews.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-pri-([0-9]+).html$ product_reviews_info.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-t-([0-9_]+).html$ articles.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-au-([0-9]+).html$ articles.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-a-([0-9]+).html$ article_info.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-i-([0-9]+).html$ information.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-links-([0-9_]+).html$ links.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-n-([0-9]+).html$ newsdesk_info.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-nc-([0-9]+).html$ newsdesk_index.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-nri-([0-9]+).html$ newsdesk_reviews_info.php [NC,L,QSA]
 RewriteRule ^([a-z0-9-/]+)-nra-([0-9]+).html$ newsdesk_reviews_article.php [NC,L,QSA]

 

 

but together with changing admin to rewrite I get errors, hence I have taken it out so that my site can operate.

Perhaps, the index.php it is not removable!

Link to comment
Share on other sites

http://www.nontando.com/index.php/ceramics-c-67

 

The .htaccess you added is going to do nothing. First of all, it's looking for a URI like "/ceramics-c-67.html", and will not match the pattern. (Aside: the pattern should really be \.html, not .html, and I think $1 is going to consume the - in -c-.) Are you sure that's the one provided with your SEO add-on? Did you add some other add-on to get rid of .html? Second, it puts "ceramics" into $1 and "67" into $2, but the rewrite target doesn't use either of them. You want to end up with a URI something like "/index.php?cat=67" (I don't know where "ceramics" is going to be used -- possibly not at all). In short, the .htaccess codes you added don't match the PHP code that changed the URL output.

 

P.S. Please don't PM me for support unless I ask you to, or give permission. It's better to have a public record of how to fix the problem, so that others may learn from it. Use back channels only if confidential information such as passwords are involved.

Link to comment
Share on other sites

Mr Phil, I apologize for PM'ing you.

 

 

g2777(Graham) has just fixed the problem, i.e. managed to remove the index.php from the url

 

As per your message I will try and tackle replacing with http://www.nontando.com/ceramics-c-67.html with http://www.nontando.com/ceramics.html

as I would imagine this will help with SEO not too mention make more visual sense.

 

I apologize again and thank you for your input. Gary

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...