1

I am completely dumb when it comes to .htaccess, even through my numerous attempts to learn the basics. So I am here:

This is my current .htaccess:

RewriteEngine on
RewriteRule ^$ /splash [L,R=301]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
RewriteRule ^([a-z0-9-]+)/?$ /index.php?cat=$1 [L,NC,QSA]

I would like to keep its current functionality and add two things so its like:

1 Answer 1

2

You can use:

RewriteEngine on
RewriteRule ^$ /splash [L,R=301]

RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} \s(.+?)/+[?\s]
RewriteRule ^(.+?)/$ /$1 [R=301,L]

RewriteRule ^([a-z0-9-]+)/?$ /index.php?cat=$1 [L,NC,QSA]

RewriteRule ^([a-z0-9-]+)/([a-z0-9-]+)/?$ /index.php?cat=$1&product=$2 [L,NC,QSA]
Sign up to request clarification or add additional context in comments.

1 Comment

Works! Even though my css stopped working, it turned out to be caused by missing base tag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.