Unstoppable Domains

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

Spaceship Spaceship
Watch
Impact
111
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?


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
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
something like this?

.htaccess
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule (.*).html$ /show.php?value=$1

show.php
PHP:
<?php
echo $_GET['value'];

$data = explode('.', $value);
echo $data[0] . "<br>";
echo $data[1];
?>

should work the way you want, i think
 
0
•••
Does that work with ANYTHING after the dot or only .html files?
 
0
•••
<?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
 
0
•••
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...
 
0
•••
Anybody can help? I've raised the reward to 100 NP$.
 
0
•••
try:


Options +FollowSymLinks
RewriteEngine on
rewriteRule ^([^_]+)/ /show.php?value=$1 [L]
 
0
•••
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.
 
0
•••
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/
 
0
•••
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.
 
0
•••
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
 
0
•••
Awesome - but it's still not working... what can I change to make it work without breaking it?
 
0
•••
compuXP said:
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?
 
0
•••
Nevermind... just get it working :D
 
0
•••
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


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
 
0
•••
Thanks - VERY nice :) 110 NP$ on the way! Great job - many thanks again.

-Matt
 
0
•••
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back