I want to redirect all url of particular folder to another location if there is no extension exist at the end of url.
I have “Test” folder in the server.
my url are like
www.example.com/Test/abc
www.example.com/Test/abc1
www.example.com/Test/abc2
So i want that when user click on these url then it will be redirect to the index page(www.example.com/index.php)
But if url have extension at the end then it should not be redirect.
like www.example.com/Test/logo.jpg, www.example.com/Test/p1.mp3
I have tried to do it using .htaccess file. and i am able to redirect to index page but my problem is that when user click on any image url or mp3 url then it will also redirect user to index page.
here is my .htaccess file
<IfModule mod_rewrite.c>
Options +SymLinksIfOwnerMatch
RewriteEngine On
Redirect /Test http://example.com/index.php?id=
</IfModule>
It redirect me to the following url
http://example.com/index.php?id=abc (if i clicked on http://example.com/Test/abc)
Any Idea?
3
Answers
Well in
.htaccess
you could do something like:If you want a
301
redirect:Could you please try this? I have not tested it but it should work for you.