LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-25-2010, 12:53 PM   #1
jnojr
Member
 
Registered: Sep 2007
Location: Chandler, AZ
Posts: 227

Rep: Reputation: 20
httpd rewrite rule


There is an old application out there with a link to what used to be a wiki, https://server1.domian/wiki/index.php server1 no longer hosts the wiki, so I added a statement to httpd.conf:

Redirect permanent /wiki https://server2.domain/wiki/index.php/New_Wiki

That gets me to a URL:

https://server2.domain/wiki/index.ph...Wiki/index.php

So I added a second rule:

Redirect permanent /wiki/index.php https://server2.domain/wiki/index.php/New_Wiki

But I'm still being redirected to https://server2.domain/wiki/index.ph...Wiki/index.php I would prefer to handle this correctly on server1 rather than adding a rule on server2 to redirect /wiki/index.php/New_Wiki/index.php to /wiki/index.php/New_Wiki
 
Old 01-25-2010, 01:18 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

I cannot see what your problem really is? Isn't that the same URL?
assuming that index.php is the DirectoryIndex page.
 
Old 01-25-2010, 01:37 PM   #3
jnojr
Member
 
Registered: Sep 2007
Location: Chandler, AZ
Posts: 227

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by bathory View Post
Hi,

I cannot see what your problem really is? Isn't that the same URL?
assuming that index.php is the DirectoryIndex page.
Look again...

https://server2.domain/wiki/index.ph...Wiki/index.php

And:

https://server2.domain/wiki/index.php/New_Wiki

How many "index.php"s do I need? :-P
 
Old 01-25-2010, 01:48 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
From what I can understand, you want to redirect:
to
The last index.php is the DirectoryIndex. If you access the old server using https://server1.domian/wiki, then you'll be redirected to https://server2.domain/wiki/index.php/New_Wiki. If you add index.php in the 1st URL and it's also added to the second. That's how redirect works.
 
Old 01-25-2010, 05:09 PM   #5
jnojr
Member
 
Registered: Sep 2007
Location: Chandler, AZ
Posts: 227

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by bathory View Post
From what I can understand, you want to redirect:
to

The last index.php is the DirectoryIndex. If you access the old server using https://server1.domian/wiki, then you'll be redirected to https://server2.domain/wiki/index.php/New_Wiki. If you add index.php in the 1st URL and it's also added to the second. That's how redirect works.
I need it to strip off the last index.php

There is only one index.php, at /wiki/index.php All content of the wiki is at /wiki/index.php/Wiki_Content

I need the first server to take requests to /wiki/index.php and redirect them to https://server2/wiki/index.php/New_Wiki
 
Old 01-25-2010, 11:28 PM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
I need the first server to take requests to /wiki/index.php and redirect them to https://server2/wiki/index.php/New_Wiki
This is what your 1st Redirect should do.
What happens of you go directly to https://server2.domain/wiki/index.php/New_Wiki? Is the last index.php appended automatically?
Anyway you can try the same with mod_rewrite:
Code:
RewriteEngine on

RewriteCond %{REQUEST_URI} ^/blog
RewriteRule (.*)/index.php$ https://server2.domain/wiki/index.php/New_Wiki
Regards
 
  


Reply



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
Need help with apache Rewrite Rule? your_shadow03 Linux - Newbie 1 01-21-2010 07:12 AM
Linux Apache Rewrite Rule jon_k Linux - Software 1 06-10-2009 02:09 AM
Rewrite rule in ssl.conf uks Linux - Software 0 02-10-2009 08:35 AM
Apache rewrite rule help kinetik Linux - Software 1 11-05-2007 11:18 AM
i need a rewrite rule!help arcow Linux - Enterprise 1 07-03-2007 05:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

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
Open Source Consulting | Domain Registration