.HTACCESS redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
J0kerz
Forum Commoner
Posts: 37
Joined: Fri May 29, 2009 2:51 pm

.HTACCESS redirect

Post by J0kerz »

Hi there,

I have a code in my .htacces file to redirect all pages of my website to my homepage for a short amount of time. The code is as follow:

Code: Select all

RewriteEngine On
RewriteBase /
RewriteRule ^(.+)\.php$ / [R=302,L]
When I add this piece of code, my website wont load at all.

Is there anything wrong with my syntax or any php things I should setup?

Thanks guys,
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: .HTACCESS redirect

Post by twinedev »

I think, but am not sure, that you actually for a rewrite rule need the actual file name you are sending people to instead of just the / do /index.php (or whichever one you are using).

-Greg
User avatar
J0kerz
Forum Commoner
Posts: 37
Joined: Fri May 29, 2009 2:51 pm

Re: .HTACCESS redirect

Post by J0kerz »

The above code worked well for the last few months but now it doesnt seem to work anymore.

It is strange, what could be the issue?
Post Reply