NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page 25 NP$ for a working .htaccess file...

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 10-22-2005, 12:23 PM THREAD STARTER               #1 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)

25 NP$ for a working .htaccess file...


Hi,

Can I have somebody write a .htaccess file that will redirect all subdirectories with at LEAST 1 dot (there can be more) in it to a .php file?
????: NamePros.com http://www.namepros.com/programming/134000-25-np-for-working-htaccess-file.html


Eg:

www.domain.com/subdirectory.e

Redirects to a file called show.php (in the public_html directory)

Then, to the PHP file, send two variables: the text before the FIRST dot (there can be more than one dot in the directory name, like "subdirectory.e.v") and the text AFTER the first dot, but ignoring ALL OTHER dots (the first dot should NOT be included in any variable)

So, in this:

www.domain.com/subdirectory.e.v

Should send only 2 variables to the PHP file:

$var1 = "subdirectory"
$var2 = "e.v"

(There will never be more than 2 dots if you need to know, but always at least 1)

25 NP$ to the person who can do this!

Thanks,
-Matt
mholt is offline  
Old 10-22-2005, 08:45 PM   #2 (permalink)
NamePros Regular
 
nick's Avatar
Join Date: Jun 2004
Location: Iowa City
Posts: 705
nick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud of
 


Save The Children
something like this?

.htaccess
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule (.*).html$ /show.php?value=$1
show.php
PHP Code:
<?php
????: NamePros.com http://www.namepros.com/showthread.php?t=134000
echo $_GET['value'];

$data explode('.'$value);
echo 
$data[0] . "<br>";
echo 
$data[1];
?>
should work the way you want, i think
__________________
formally ninedogger
------
Want to talk to a stranger? -->| Click Here | TalkToAStranger.com | <-- Meet New Friends
nick is offline  
Old 10-23-2005, 12:38 PM THREAD STARTER               #3 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Does that work with ANYTHING after the dot or only .html files?
mholt is offline  
Old 10-23-2005, 01:44 PM   #4 (permalink)
NamePros Regular
 
nick's Avatar
Join Date: Jun 2004
Location: Iowa City
Posts: 705
nick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud of
 


Save The Children
<?php
echo $_GET['value'];

$data = explode('.', $value);
$var1 = $data[0]; // subdirectory
$var2 = $data[1]; // e.v
?>


im pritty sure you dont need the .html part in that .htaccess, not sure i'll see if that changes the that whole thing
__________________
formally ninedogger
------
Want to talk to a stranger? -->| Click Here | TalkToAStranger.com | <-- Meet New Friends
nick is offline  
Old 10-23-2005, 02:00 PM THREAD STARTER               #5 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Thanks... I don't wanna break anything - if you can test it and make sure it works I'll add an extra 10 NP$.

UPDATE:

I just tested what you gave me and it only works for .html files. It needs to work for ANY subdirectory with at least 1 dot in it.

ANOTHER UPDATE:

I got it to work with all subdirectories with a dot in it. Now, though, it outputs this all the time:

site.ph

And that shows up with the second PHP snippet you gave me.

'NOTHER UPDATE:

It redirects even when i'm not accessing a subdirectory :'(

Grrr. one last thing: It has to ignore .php files...
mholt is offline  
Old 10-24-2005, 06:19 PM THREAD STARTER               #6 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Anybody can help? I've raised the reward to 100 NP$.
mholt is offline  
Old 10-24-2005, 09:30 PM   #7 (permalink)
NamePros Regular
 
nick's Avatar
Join Date: Jun 2004
Location: Iowa City
Posts: 705
nick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud of
 


Save The Children
try:


Options +FollowSymLinks
RewriteEngine on
rewriteRule ^([^_]+)/ /show.php?value=$1 [L]
__________________
formally ninedogger
------
Want to talk to a stranger? -->| Click Here | TalkToAStranger.com | <-- Meet New Friends
nick is offline  
Old 10-25-2005, 02:05 PM THREAD STARTER               #8 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Sorry but that doesn't work. It says that, when I type domain.com/sub.directory it says: "sub.directory is not found".

Any help appreciated - 100 NP$ reward!

EDIT: That snippet you gave me only works if the subdirectories exist... :-/ Otherwise I THINK it's right.
mholt is offline  
Old 10-25-2005, 03:30 PM   #9 (permalink)
NamePros Regular
 
nick's Avatar
Join Date: Jun 2004
Location: Iowa City
Posts: 705
nick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud of
 


Save The Children
I got it this time...Works when I tested

.htaccess
RewriteEngine on
RewriteRule ^(.*)/$ show.php?value=$1


show.php PHP file (for testing)
<?php
echo $value;
?>


I got it to only work when / was at the end of the url

example: w ww.domain.com/document.title/
__________________
formally ninedogger
------
Want to talk to a stranger? -->| Click Here | TalkToAStranger.com | <-- Meet New Friends
nick is offline  
Old 10-25-2005, 03:33 PM THREAD STARTER               #10 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Get it to work without that slash and i'll give you 110 NP$.

UPDATE: It also will kick in if the string DOESN'T have a dot... if you can fix that then that'd be great but you don't absolutely HAVE to. It won't kill my project But that ending slash will.
mholt is offline  
Old 10-25-2005, 05:30 PM   #11 (permalink)
NamePros Regular
 
nick's Avatar
Join Date: Jun 2004
Location: Iowa City
Posts: 705
nick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud of
 


Save The Children
Code:
RewriteEngine on
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule (.*) http://www.domain.com/directory/$1/ [R=301,L]

RewriteRule ^(.*)/$ show.php?value=$1

100% Confident this time!

It will automatically add the / at the end if its not there (it is required)

so now it works with or w/o
__________________
formally ninedogger
------
Want to talk to a stranger? -->| Click Here | TalkToAStranger.com | <-- Meet New Friends
nick is offline  
Old 10-25-2005, 05:40 PM THREAD STARTER               #12 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Awesome - but it's still not working... what can I change to make it work without breaking it?
mholt is offline  
Old 10-25-2005, 05:41 PM   #13 (permalink)
NamePros Regular
 
nick's Avatar
Join Date: Jun 2004
Location: Iowa City
Posts: 705
nick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud of
 


Save The Children
Originally Posted by compuXP
Awesome - but it's still not working... what can I change to make it work without breaking it?
what do you mean by breaking it?
__________________
formally ninedogger
------
Want to talk to a stranger? -->| Click Here | TalkToAStranger.com | <-- Meet New Friends
nick is offline  
Old 10-25-2005, 06:03 PM THREAD STARTER               #14 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Nevermind... just get it working
mholt is offline  
Old 10-25-2005, 06:37 PM   #15 (permalink)
NamePros Regular
 
nick's Avatar
Join Date: Jun 2004
Location: Iowa City
Posts: 705
nick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud of
 


Save The Children
So many FAILED attempts

Would you settle for this?

Code:
RewriteEngine on
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} (\.com|\.net|\.org)
RewriteRule (.*) http://www.gamingempires.com/test/$1/ [L]

RewriteRule ^(.*)/$ productinfo.php?prodID=$1

????: NamePros.com http://www.namepros.com/showthread.php?t=134000
The only thing that that allows is .com/.net/org (lowercase)
you can add more extensions


This is the only solution I could come up with at first it was: !\. but that caused problems when there was just domain.com



tested this over and over and seems to be good
__________________
formally ninedogger
------
Want to talk to a stranger? -->| Click Here | TalkToAStranger.com | <-- Meet New Friends
nick is offline  
Old 10-25-2005, 06:41 PM THREAD STARTER               #16 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Thanks - VERY nice 110 NP$ on the way! Great job - many thanks again.

-Matt
mholt is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
MusicSharing.net Domainut Domains For Sale - Make Offer 13 01-30-2004 09:15 PM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 06:27 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger