2

I having issue for re-writing url from

http://localhost/cs/compare?slug=wash-safe-industries.html    

to

http://localhost/cs/compare/wash-safe-industries.html

I have tried following code in .htaccess but does not work for me, I have also searched various sites but still facing issues

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^/?compare/(.*?)/?$ /compare.php?slug=$1 [L]

Also tried following line of code

RewriteRule ^cs/(.*)$ cs/compare.php?slug=$1 [L,QSA]

Please help me out thanks

2
  • @anubhava yes it is throwing 404 error Commented Jan 20, 2016 at 11:23
  • 1
    @anubhava in the cs folder Commented Jan 20, 2016 at 11:29

3 Answers 3

2

Try this .htaccess in /cs/ sub-directory:

Options -MultiViews
RewriteEngine on
RewriteBase /cs/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^compare/(.+?)/?$ compare.php?slug=$1 [L,NC,QSA]
Sign up to request clarification or add additional context in comments.

Comments

1

Try using following line of code:

Options -MultiViews
RewriteEngine On
RewriteRule ^compare/(.+?)/?$ compare.php?slug=$1 [L,NC,QSA]

Comments

0

You have to write as follows, try this one.

RewriteRule ^compare/wash-safe-industries.html compare?slug=wash-safe-industries.html

Comments

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.