Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

.htaccess redirects/rewrites help

Featured Replies

Hi, I'm having some trouble setting up my htaccess file. I solved index.php to just root but nothing else seems to work afterwards...

 

I'm trying to get "http://www.domain.com/bassaya-lingerie"'>http://www.domain.com/Bassaya-Lingerie" redirected to "http://www.domain.com/bassaya-lingerie" and I've tried a load of rules but it either completely borks my site or does nothing.

 

And another thing I want to do is change "http://www.domain.com/index.php?route=product/manufacturer" to "http://www.domain.com/brands/" but I'm not sure if this is possible?

 

Here's my htaccess:

 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

# Prevent Directoy listing 
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
Order deny,allow
Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

### Additional Settings that may need to be enabled for some servers 
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule ^index\.php$ http://www.domain.com/? [R=301]

RewriteRule ^bassaya-lingerie$ /Bassaya-Lingerie [L]

 

Really appreciate any help, I suspect it's something daft like a typo....

 

Cheers,

~evu.

Rather than using a specific rule for the URL /Bassaya-Lingerie, why not use something like this:

 

RewriteMap  lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]

  • Author

Why? Because I don't really have any idea what I'm doing hehe.

 

I did try it though RD but it didn't work, infact it borked the site again. "Internal Server Error" :(

 

It's ok to be specific, there's only about 4 categories I need to do this to, though like I said I can't seem to get anything to work...

 

I'm trying to do it on an Opencart site, if it matters?

 

Cheers RD mate,

~evu.

Ah. Opencart is MVC, which means mod_rewrite isn't handling the URLs - it hands off everything to Opencart's front controller by rewriting everything to index.php.

 

My bad, I should have noticed it in the comments.

Edited by Renaissance-Design

  • Author

Oh, so it's not possible to do rewrites with anything but index.php? Explains why nothing else works then...

 

Cheers dude,

~evu.

  • Author

You can, but you;d need to update the common seo url controller and update the database url alias table iirc.

Ah, sounds quite complicated then... Maybe I'll just have to deal with it.

 

Cheers dude,

~evu.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.