1

I have the following .htaccess file working on the local MAMP server fine. However when I upload it to the main server it can't find the news page.

RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} \s/+news\.php\?news_id=([^\s&]+) [NC]
RewriteRule ^ /news/%1? [R=301,L]

RewriteCond %{THE_REQUEST} \s/+Category\.php\?pageNum_RS_Search=([^\s&]+)&totalRows_RS_Search=([^\s&]+)&Category=([^\s&]+) [NC]
RewriteRule ^ /Compare/%1/%2/%3? [R=301,L]

RewriteCond %{THE_REQUEST} \s/+Category\.php\?Category=([^\s&]+) [NC]
RewriteRule ^ /Compare/%1? [R=301,L]

RewriteCond %{THE_REQUEST} \s/+product\.php\?id=([^\s&]+) [NC]
RewriteRule ^ %1? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)?$ product.php?id=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^Compare/([^/]+)/?$ Category.php?Category=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^Compare/([^/]+)/([^/]+)/([^/]+)/?$ Category.php?pageNum_RS_Search=$1&totalRows_RS_Search=$2&Category=$3 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^news/([^/]+)/?$ news.php?news_id=$1 [L,QSA]

The Category and product redirects work fine on the main server however the news doesn't gives a 404 error

other rewrite rules one level higher

rewriteengine on
rewritecond %{HTTP_HOST} ^www.mysite1.co.uk$ [OR]
rewritecond %{HTTP_HOST} ^mysite1.co.uk$
rewriterule ^(.*)$ "http\:\/\/mysite\.co\.uk\/$1" [R=301,L] #5311a623b538f
rewritecond %{HTTP_HOST} ^www.mysite.co.uk$ [OR]
rewritecond %{HTTP_HOST} ^mysite.co.uk$
rewriterule ^Pianoshop\/detailed_page\.php(.*)$ "http\:\/\/mysite\.co\.uk\/product\.php$1" [R=301,L] #5310700a7e477
rewritecond %{HTTP_HOST} ^www.mysite.co.uk$ [OR]
rewritecond %{HTTP_HOST} ^mysite.co.uk$
rewriterule ^Pianoshop\/index_blog\.php(.*)$ "http\:\/\/mysite\.co\.uk\/news\.php$1" [R=301,L] #531
Ria
  • 516
  • 6
  • 24

2 Answers2

0

In most cases it will be problem with apache configuration check your apache configuration

Check This for more Information

Community
  • 1
  • 1
Arun Kumar
  • 1,190
  • 8
  • 15
0

I suspect this is happening due to MultiViews option enabled on your live server which conflicts with `mod_rewrite.

Add this line on top of your .htaccess to disable it:

Options -MultiViews
anubhava
  • 761,203
  • 64
  • 569
  • 643