Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite help needed

         

JonSimmonds

3:17 pm on Mar 10, 2006 (gmt 0)

10+ Year Member



Hi

I had a wiki at the address www.site.com/wiki/

As part of a mini re layout I moved the wiki to wiki.site.com (and cpanel uses the folder wiki in the file system)

I am trying to redirect links from the old folder wiki to the new subdomain one. A simple redirect I can do, but when trying to redirect a link like this is were I hit the brick wall

www.site.com/wiki/index.php/widget

Ive spent the good part of today trying to solve this, mainly by seearching forums and google to no joy, any help?

Jon

jdMorgan

5:27 pm on Mar 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Jon,

Welcome to WebmasterWorld!

This should not be particularly difficult, but please post your code so we can discuss it -- See our forum charter (link above) for more info.

Jim

JonSimmonds

6:00 pm on Mar 10, 2006 (gmt 0)

10+ Year Member



The code I currently have in the "wiki" folder, which is used to remove the index.pho (hxtp://wiki.site.com/index.php/widget becomes hxtp://wiki.site.com/widget)

--

RewriteEngine on
RewriteRule ^(images¦skins)/ - [L]
RewriteRule .*\.php$ - [L]
RewriteRule ^/?(.*)$ /index.php?title=$1 [L,QSA]

--
The only solution I got to half work was by placing the following code in my main folder (since the old link was site.com/wiki/index.php/widget)

--
RedirectMatch permanent ^/wiki/$ http://wiki.site.com

--

[edited by: JonSimmonds at 6:10 pm (utc) on Mar. 10, 2006]

[edited by: jdMorgan at 9:21 pm (utc) on Mar. 10, 2006]
[edit reason] De-linked [/edit]

JonSimmonds

6:02 pm on Mar 10, 2006 (gmt 0)

10+ Year Member



my bad posted a link... cant see the edit post

I think half my problem lies in the fact that the folder "wiki" is being used for 2 things, and I may be best renaming the current subdomain?

jdMorgan

9:32 pm on Mar 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure what your URL structure looks like, and I'm afraid that your description confused me. However, if I understand the question, then your're probably looking for something like this:

RewriteEngine on
#
# Rewrite wiki folder requests to wiki subdomain
RewriteRule ^wiki(.*)$ http://wiki.example.com$1 [R=301,L]
#
# Else rewrite all requests except for /images, /skins and php files to index.php script
RewriteCond $1!^(images¦skins)/¦\.php$
RewriteRule (.*) /index.php?title=$1 [QSA,L]

Jim