Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is if else conditions available on htaccess?

Tags:

.htaccess

I have a .htaccess file in the folder "services" in my website and have to give two urls following

content of htaccess

#------------------------
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule ^(.*)$ index.php?n=$1 [L,QSA] 
</IfModule>
$-------------------------

1. http://www.mysite.com/services/seo-work
2. http://www.mysite.com/services/online-editor

The 1st URL rewritten using htaccess like http://www.mysite.com/services/index.php?s=seo-work This is working correct. but when i am uploading other file online-editor.php on the same folder "services", it is not working

so how the first url should show the page using index.php?s=seo-work if the page "online-editor.php" is not found in directory otherwise online-editor.php shoud show. I am programatically representing my problem below

if(IsFoundPageInDirectory(online-editor.php))
{
   GoToUrl(http://www.mysite.com/services/online-editor.php)
}
else
{
   GoToUrl(http://www.mysite.com/services/index.php?s=seo-work)
}

Please help me to get out of this problem Advance thanks for your reply

like image 276
Haris Avatar asked Feb 16 '10 06:02

Haris


1 Answers

There is not really if/else conditions with ifModule in Apache configuration, but you can use the test in 2 cases : !module & module, like this:

<IfModule !module>
  # default directives
</IfModule>

<IfModule module>
  # decorator directives
</IfModule>
like image 61
Nolwennig Avatar answered Nov 20 '22 21:11

Nolwennig