I Need just a LITTLE help with .htaccess rewrite...

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
jclarkkent2003
Forum Contributor
Posts: 123
Joined: Sat Dec 04, 2004 9:14 pm

I Need just a LITTLE help with .htaccess rewrite...

Post by jclarkkent2003 »

Code: Select all

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>

# END WordPress
This works for wordpress, but I need something ADDED to it.

I need to have ANY requests to

http://www.mydomain.com/xmlpc-1.php
http://www.mydomain.com/xmlpc-2php
http://www.mydomain.com/xmlpc-3.php
http://www.mydomain.com/xmlpc-4.php

transparently go to

/xmlpc.php

Anybody knows how I can do that?

I have been trying:


RewriteRule ^xmlpc-(.*)\.php$ /xmlpc.php

But that line has NOT been working, in fact I added it and it makes my entire site error 500.

Any ideas is very much appreciated..
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

Code: Select all

Redirect /olddirectory/oldfile.html http://yoursite.com/newdirectory/newfile.html
jclarkkent2003
Forum Contributor
Posts: 123
Joined: Sat Dec 04, 2004 9:14 pm

Post by jclarkkent2003 »

it's gotta be transparent, that I believe physically redirects the user's browser.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

that code i posted doesnt work?

also, what do you mean by transparent?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

RewriteRule ^xmlpc-(.*)\.php$ xmlpc.php


there should be no slash on xmlpc.php
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Code: Select all

RewriteRule ^xmlpc-(1-4).php$ xmlpc.php
Edit | this is the correct version :oops:

Code: Select all

RewriteRule ^xmlpc-[1-4].php$ xmlpc.php
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

What if that list was supposed to have an "etc..."

assuming its just numbers the wildcard should be [0-9]+

When writing regex patterns like this I always try to make them as loose as possible and check the values in the scripts themselves, I favor a relevant error over a generic 404 message almost everytime
jclarkkent2003
Forum Contributor
Posts: 123
Joined: Sat Dec 04, 2004 9:14 pm

Post by jclarkkent2003 »

K i got it, I figured out RewriteRule ^xmlpc-(.*)\.php$ xmlpc.php worked by alot of testing.... Thanks :)


Can anyone help me with this?
RewriteEngine on
Options +FollowSymLinks
#RewriteBase /
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^/?$ /index.php [NC,L]
RewriteRule ^([^/]+)/?$ zwildcard/ [NC]

What I need it to do is this:

They go to my domain say:

http://www.mydomain.com/~subdomain/testing/

and there is a ~subdomain folder, but there is no TESTING folder. I need it like this:

instead of reading files from testing (which doesn't exist), it would read from /~subdomain/zwildcard and so on, so ANY FOLDER request to INSIDE of ~subdomains/ main folder will read it's contents from /~subdomain/zwildcard/ 's main folder.

Any Ideas? I know I should be putting the .htaccess inside /home/user1/~subdomain/ and that's where it put it, but when I go to http://www.mydomain.com/~subdomain/testing/ it doesn't work, it actually gives 404 or 500 error.....

Any bright ideas? I've been reading alot at mod-rewrite.com but it seems like a really dead forum and very limited posts already there.... is there a better website or forum, or even program/software that can create .htaccess rules for me?
Post Reply