Page 1 of 1

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

Posted: Wed Jan 25, 2006 9:39 pm
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..

Posted: Wed Jan 25, 2006 11:01 pm
by nickman013

Code: Select all

Redirect /olddirectory/oldfile.html http://yoursite.com/newdirectory/newfile.html

Posted: Wed Jan 25, 2006 11:03 pm
by jclarkkent2003
it's gotta be transparent, that I believe physically redirects the user's browser.

Posted: Thu Jan 26, 2006 12:12 am
by nickman013
that code i posted doesnt work?

also, what do you mean by transparent?

Posted: Thu Jan 26, 2006 9:02 am
by josh
RewriteRule ^xmlpc-(.*)\.php$ xmlpc.php


there should be no slash on xmlpc.php

Posted: Thu Jan 26, 2006 10:11 am
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

Posted: Thu Jan 26, 2006 12:00 pm
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

Posted: Sat Jan 28, 2006 4:30 pm
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?