1

I have this address

http://name.com/category/1/news

I use this code in htaccess to force open page without www.

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

When I open http://www.name.com/category/1/news then I redirect to

http://name.com/category.php?id=1&slug=news

Here is my full htaccess file.

RewriteEngine on
RewriteRule ^news/(.*)$ news.php?id=$1&slug=$2
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

Thanks.

leopoldjobs
  • 65
  • 1
  • 1
  • 8

1 Answers1

0

Try :

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [NE,R=301,L]
RewriteRule ^news/(.*)$ news.php?id=$1&slug=$2 [NC,L]
Amit Verma
  • 40,709
  • 21
  • 93
  • 115