PhoneSupport
11-21-2005, 07:43 PM
Options +FollowSymlinks
RewriteEngine on
RewriteOptions inherit
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteRule ^/(.*)$ ../viewpofile.php?user=$1 [L]
I have put in a folder /users/ (Of which is on a subdomain) however every time I goto users.domain.com/myusername I just get a 404 error. That PHP file is there. I even copied it into the user dir and renamed it do it was /viewprofile.php and still 404 error.
Any idea's?
Thanks
extras
11-23-2005, 06:19 PM
RewriteRule ^/(.*)$ ../viewpofile.php?user=$1 [L]
I don't think you can use ../ in the substitution.
Also, if you are using the rule in .htaccess, ^/(.*)$ will not match.
PhoneSupport
11-23-2005, 06:38 PM
RewriteRule ^/(.*)$ ../viewpofile.php?user=$1 [L]
I don't think you can use ../ in the substitution.
Also, if you are using the rule in .htaccess, ^/(.*)$ will not match.
Hello,
I tried it with the file in the same location without the slashes and still does not work.
If
^/(.*)$
is incorrect what is the best replacement for it?
Basically I want it so people can go users.domain.com/theusername and it goes to viewprofile.php?username=theusername
Thanks,
James
extras
11-24-2005, 01:29 AM
RewriteRule is influenced by many factors.
To determine exact rule, you need to show entire .htaccess of all directories concerned.
Otherwise, we can miss small detail and the rule may fail.
Having said that, if the "viewpofile.php" is in the document root, this may do.
RewriteRule ^/*(.*)$ /viewpofile.php?user=$1 [L]
PhoneSupport
11-24-2005, 11:46 AM
Hey Extra's..
When I use that I get a
HTTP 500 Internal Server Error
Any idea's?
Thanks.. :)
extras
11-24-2005, 12:10 PM
As you don't show much data, it's hard to say.
When you report back, show exactly what you did, what you got as result.
Check your error log, first.
It will tell you the cause in some cases.
Common mistakes are:
Wrong FTP transfer mode causing bad line ending. ==> make sure to use ascii transfer.
Syntax error somewhere.
Using Directive of modules not loaded.
If you are putting that in .htaccess, use RewriteBase and remove slash from substitution.
RewriteBase /
RewriteRule ^/*(.*)$ viewpofile.php?user=$1 [L]
Or, add loop stopper.
RewriteCond %{REQUEST_URI} !/viewpofile.php
RewriteRule ^/*(.*)$ /viewpofile.php?user=$1 [L]
These will remedy the 500 error if it's caused by looping.
acidhoss
11-25-2005, 08:10 PM
what are you trying to match? have you read the mod_rewrite docs thoroughly?