Post by ssnoro » Thu Jun 22, 2017 2:28 am

I would like to change ugly URL like contact, manufacturer to nice url. I changed in .htaccess but it does not work

For change URL domain/index.php?route=information/contact to nice domain/contact I have wrote this rule

RewriteRule ^contact$ index.php?route=information/contact [L]

but nothing happened.

Newbie

Posts

Joined
Sat May 28, 2016 5:09 am

Post by IP_CAM » Thu Jun 22, 2017 6:53 am

why not just using something like this ?
Ernie
Seo URL Static Page
https://www.opencart.com/index.php?rout ... n_id=26068
---

Code: Select all

 private $urlFriendly = array(
    'common/home'                   => 'index',
    'account/register'              => 'create-account',
    'account/login'                 => 'login',
    'account/logout'                => 'logout',
    'account/newsletter'            => 'newsletter',
    'account/wishlist'              => 'wishlist',
    'account/order'                 => 'order-history',
    'account/account'               => 'my-account',
    'account/forgotten'             => 'forgot-password',
    'account/download'              => 'downloads',
    'account/return'                => 'returns',
    'account/transaction'           => 'transactions',
    'account/password'              => 'change-password',
    'account/edit'                  => 'edit-account',
    'account/address'               => 'address-book',
    'account/reward'                => 'reward-points',
    'account/return/add'            => 'request-add',
    'account/voucher'               => 'voucher',
    'information/contact'           => 'contact',
    'information/contact/success'   => 'contact-success',
    'information/sitemap'           => 'sitemap',
    'affiliate/register'            => 'create-affiliate-account',
    'affiliate/login'               => 'affiliate-login',
    'affiliate/logout'              => 'affiliate-logout',
    'affiliate/account'             => 'affiliates',
    'affiliate/edit'                => 'edit-affiliate-account',
    'affiliate/password'            => 'change-affiliate-password',
    'affiliate/payment'             => 'affiliate-payment-options',
    'affiliate/tracking'            => 'ffiliate-tracking-code',
    'affiliate/transaction'         => 'affiliate-transactions',
    'affiliate/forgotten'           => 'affiliate-forgot-password',
    'checkout/cart'                 => 'shopping-cart',
    'checkout/checkout'             => 'checkout',
    'checkout/voucher'              => 'gift-vouchers',
    'product/special'               => 'specials',
    'product/manufacturer'          => 'brands',
    'product/compare'               => 'compare-products',
    'product/search'                => 'search',
  ); 

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by thekrotek » Thu Jun 22, 2017 2:42 pm

Because you're trying to redirect to non-existing URL. OpenCart doesn't know, what to display on "contact" request and will show you the error page. SEO URL router in OpenCart works differently.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by Johnathan » Thu Jun 22, 2017 10:28 pm

If you want an extension that can do this without hassling with htaccess, Rewrite Manager can do what you're looking for. Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any further questions.

If you want to use htaccess, your rewrite looks correct, but you're going to need to change all the URLs in your site to use the new version (e.g. www.mydomain.com/contact) instead of the old version (e.g. www.mydomain.com/index.php?route=information/contact).

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by MrPhil » Fri Jun 23, 2017 10:25 pm

ssnoro wrote:
Thu Jun 22, 2017 2:28 am
I would like to change ugly URL like contact, manufacturer to nice url. I changed in .htaccess but it does not work

For change URL domain/index.php?route=information/contact to nice domain/contact I have wrote this rule

RewriteRule ^contact$ index.php?route=information/contact [L]

but nothing happened.
Is the original complaint that the store is still producing the old style (/index.php?route=information/contact) URI, or that .htaccess is failing to rewrite a new style URI of /contact into the old style URI? If the former, you have to do something in the code to produce new style URIs in your links -- simply rewriting in .htaccess isn't going to do it. If the latter, perhaps you have an active RewriteCond ahead of your RewriteRule, that is suppressing the action of the RewriteRule. You would have to add a RewriteCond so that this RewriteRule is executed. Also make sure there is a RewriteEngine On somewhere ahead of this rewrite, or it won't get run. Finally, and obviously, you're on a server that bothers to read and use .htaccess?

If you're wanting to change certain URIs to "nice" forms, I agree that you're better off installing an SEO extension to take care of all these things.

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm
Who is online

Users browsing this forum: awex and 223 guests