yarek
yarek

Reputation: 12044

.htaccess redirect if containing a substring

I need to create an .htaccess file that:

if url contains "chat.swf", then redirect to "chat.php"

I tried with

RewriteCond %{REQUEST_URI} chat\.swf
RewriteRule .* chat.php [R=301,L]

But it seems bad

Any idea ?

Regards

Upvotes: 0

Views: 384

Answers (2)

anubhava
anubhava

Reputation: 785196

Cear your browser cache & restart then try this rule:

RewriteEngine On
RewriteBase /
RewriteRule chat\.swf /chat.php [R=301,L,NC]

If for some reason this doesn't work, post your complete .htaccess in your question.

Upvotes: 0

MrSimpleMind
MrSimpleMind

Reputation: 8597

Try this

RewriteEngine On

RewriteRule ^.*\chat.swf$ /chat.php [R=301,L]

Upvotes: 1

Related Questions