LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-12-2012, 08:22 PM   #1
mohitvad
Member
 
Registered: Feb 2010
Posts: 34

Rep: Reputation: 0
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

Last edited by mohitvad; 09-12-2012 at 08:37 PM.
 
Old 09-12-2012, 09:05 PM   #2
Habitual
LQ 5k Club
 
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,591
Blog Entries: 15

Rep: Reputation: Disabled
Do you have access to the Apache .conf files?

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

Last edited by Habitual; 09-12-2012 at 09:09 PM.
 
Old 09-13-2012, 01:04 AM   #3
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558
Blog Entries: 5

Rep: Reputation: Disabled
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
 
Old 09-14-2012, 04:18 PM   #4
mohitvad
Member
 
Registered: Feb 2010
Posts: 34

Original Poster
Rep: Reputation: 0
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]
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] rewrite rule for apache linux_kung_fu Linux - General 2 07-04-2012 11:35 AM
apache rewrite rule sunlinux Linux - Newbie 10 11-11-2011 06:01 AM
apache rewrite rule sunlinux Linux - Server 2 09-25-2011 03:03 PM
Need help with apache Rewrite Rule? your_shadow03 Linux - Newbie 1 01-21-2010 08:12 AM
Apache rewrite rule help kinetik Linux - Software 1 11-05-2007 12:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration