LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rewrite rule in apache (https://www.linuxquestions.org/questions/linux-newbie-8/rewrite-rule-in-apache-4175426965/)

mohitvad 09-12-2012 07:22 PM

rewrite rule in apache
 
Hi,

Can you please help me to write the syntax for rewrite rule in apache to get the below results? it should be for all subdomains and all .act files on the server

http://abc.test.com/jack.act
should redirect
http://abc.test.com/jack.php


Thanks,
Mohit

Habitual 09-12-2012 08:05 PM

Do you have access to the Apache .conf files?

else, it's .htaccess time. See http://corz.org/serv/tricks/htaccess2.php

jsaravana87 09-13-2012 12:04 AM

Hi
You can rewrite using mod_Proxy.First of all check whether you had enabled the module


#httpd -M
LoadModule proxy_module bin/mod_proxy.so
LoadModule proxy_http_module bin/mod_proxy_http.so

ProxyPass /jack.act http://abc.test.com/jack.php
ProxyPassReverse /jack.act http://abc.test.com/jack.php

mohitvad 09-14-2012 03:18 PM

I used following rewrite rules in my httpd.conf and it solved the prob

For http

RewriteEngine On
RewriteRule ^/(.*).act(.*) /$1.php$2 [P,R=301]

For https

RewriteEngine On
RewriteRule ^/(.*).act(.*) /$1.php$2 [L,R=301]


All times are GMT -5. The time now is 07:07 AM.