stu177
stu177

Reputation: 567

.htaccess Redirect Issue, Conflicting With Rewrite

I am currently having an issue with redirects in my .htaccess file which is conflicting with a rewrite rule that is used for serving pages in our CMS.

Here is my .htaccess:

RewriteEngine On
Options +FollowSymlinks
Options -Indexes

Redirect 301 /test-page http://www.example.com/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]+)/?$ index.php?slug=$1

The problem is when I go to http://www.example.com/test-page, I get redirected to http://www.example.com/?slug=test-page rather than http://www.example.com.

Any help is greatly appreciated.

Thank You.

Upvotes: 0

Views: 40

Answers (1)

Raphael Müller
Raphael Müller

Reputation: 2200

Add

#this one prevents /test-page from further processing
RewriteRule ^test-page - [L]

between the redirect 301 and your other conditions.

Upvotes: 1

Related Questions