Kbir Mhrjn
Kbir Mhrjn

Reputation: 215

.htaccess not redirecting properly

I've gone through stackoverflow.com quiet a bit but I believe I didn't find what I was looking for. So, Here it goes. I have a .htaccess file which redirects properly but I have a remote test server, which it seems doesn't redirect as my developer machine does, could that might be the server's apache2 handler isn't configured properly? Okay, the code is as below.

RewriteRule ^welcome?(.*)                   public/index.php    [L]
RewriteRule ^profile?(.*)                   public/index.php    [L]
RewriteRule ^password?(.*)                  public/index.php    [L]
RewriteRule ^verify(.*)                 public/index.php    [L]

RewriteRule ^(.*)$ main.php?%{QUERY_STRING}     [L]

Now, the main.php file handles all the request that comes in, even welcome,profile,password,verify. but Now, I want to redirect specific files only to the public/index.php file, which it does in my developer machine but remote server ?

Upvotes: 1

Views: 609

Answers (1)

Prix
Prix

Reputation: 19528

Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /

RewriteRule ^(welcome|profile|password|verify) public/index.php [NC,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/(welcome|profile|password|verify) [NC]
RewriteRule ^(.*)$ main.php [QSA,L]

Give this a try.

Upvotes: 4

Related Questions