
cags
Staff Alumni-
Posts
3,217 -
Joined
-
Last visited
Everything posted by cags
-
I think dreamwest needs to become realitywest and realise that even if by some absurd long shot what he said is true, nobody really cares and he should probably stop bragging and book an appointment down at the STD clinic. Oh and... Single handedly keeping the hooking business afloat during the recent recession, good job.
-
I doubt you can successfully scrape a password protected file with file_get_contents, you will probably have to use cURL. Also, it looks like the target page is in asp, which will likely make your life a lot more difficult. You will probably have to make a cURL request to the login page, capturing the cookies as you do so, then post the login details along with the cookies, then request the page(s) that you actually want to scrape.
-
Oh, my bad. Well if the objective is to match any forward slashes at the start of the string you don't need either backslash as the forward slash character has no special meaning. The only reason to escape it is if you are using PCRE and have used it as a delimiter. But personally I'd suggest using a different delimiter, since the forward slash is all too common in patterns that involve paths or HTML.
-
1.) You should consider using preg_replace instead of ereg_replace as the latter is deprecated. 2.) Your pattern matches 1 or more capital V characters anchored to the start of the string and replaces them with noting. 3.) \V would mean any character that is not a vertical whitespace character. So essentially it would match anything that is not a newline character (making it very similar, if not the same as using .).
-
Do you have any mod_rewrite rules applied to the files?
-
Are you sure that pattern is 100% correct even as a POSIX pattern? The square brackets around the ftp part means it likely doesn't do what you want it to do. There is a page in the documentation on the difference between POSIX and PCRE. Basically you will need to add delimiters (though in your case the unnecessary capture group around the whole pattern will actually work as the delimiters rather than a capture group, meaning it will run as is). The only other thing to remember is to add the i modifier since you are using eregi_. Should take you two minutes to fix using the PCRE section of the manual, but if you get stuck let us know.
-
It's not exactly what you were asking for, but as I came across it recently and it seems fairly apt I thought I'd share it... http://net.tutsplus.com/tutorials/javascript-ajax/jquery-style-switcher/
-
What you have looks correct to me. A 404 error in this situation is normally because the RewriteRule doesn't match your URI or because the substitution pattern doesn't match an actual file. Since in your case it seems that the first pattern matches, I would assume the second doesn't. Change the following... RewriteRule ^(.{6,12})$ /pages/users/index.php?user_name=$1 If you still get the error then try the following as a debug technique... RewriteRule ^(.{6,12})$ http://www.google.com/search?q=$1 [NC] If you end up at google with 'username' as a search term then http://localhost/pages/users/index.php?user_name=$1
-
I mean that URI requests to the server which end in a .php file extension will not trigger the ErrorDocument page, i.e. requests to something like... domain.com/blah.php ...won't trigger the error document, but ... domain.com/blah.foo ...will. Remember that although in your example you were requesting .htm, this is being rewritten to php. As I said I'm not entirely sure how they have done this, they must have something in their .conf files along the lines of... <files .*\.php> # disabled here </files> How exactly it's disabled though I'm not sure. Looking at the docs I can see that ErrorDocument overrides FileInfo, but so does mod_rewrite so they can't have disabled that. So unless they can set a default value, which isn't overridden I don't know (may have a look later out of morbid curiosity).
-
Playing around with different addresses on your server (handy it being live, most peoples aren't) it would seem that your host has set-up your server so that ErrorDocument cannot be set for files with a .php extension. I'm not entirely sure how or why this is done. But that is almost certainly the case. Is it shared hosting? You might need to contact them and find out why.
-
What do you get if you just use... ErrorDocument 404 "Darn"
-
If typing in an invalid address shows a blank page, then what exactly is your '404 error redirect which works well' doing?
-
I guess I don't understand the question. That's exactly what the 'code' I provided does. If Apache see's a page isn't found then it will automatically redirect to that page, that's the whole point of the directive. If you are trying to say that a page does exist, but you are deciding in a PHP script that some content doesn't exist (i.e. vanity URLs and a user that doesn't exist) then you can just use a header('Location: /404.html'); but that isn't a page not found or mod_rewrite related question. @PradeepKr 401 is an unauthorised error message, it has nothing to do with page not found.
-
ErrorDocument 404 /404.html Obviously /404.html is the path to the file you wish to display.
-
I don't really understand what you are saying. The code you have doesn't perform a redirect, meaning it's impossible upon request of an .htm file for a .php address to be visible on the clients PC. If somewhere on your site there is a link to a .php file though, that will display in the address bar as .php so you need to fix the link.
-
Redirecting non existing subdomains to root domains
cags replied to watsmyname's topic in Apache HTTP Server
I guess I really should have mentioned that huh? Oh well, least it's working for you now. -
Doing so would seem fairly pointless as the conditions would only apply to the first RewriteRule encountered, i.e. RewriteRule ^product/(.*).html$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [L] In this situation I'd suggest inverting those conditions and 'exiting' if the file/directory does exists. Thus giving you the following code to be placed in the same place that wildteen88 mentioned. RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteRule ^ - [L]
-
You change all the links on your site so that they link to the 'pretty' version. Then use something like the following... <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} !-f RewriteCond %{REQUEST_URI} !-d RewriteRule ^[a-zA-Z0-9-]+_([0-9]+)\.html /item.php?id=$1 </IfModule>
-
Integration with Facebook (Facebook Connect)
cags replied to xeronix's topic in PHPFreaks.com Website Feedback
You'd have to take that up with the creators of SMF (the forum software this forum runs on). Whilst it could be integrated into the login of the site (which is separate to the forum), this would be pretty pointless as very few people log into the site as there is little point. -
Redirecting non existing subdomains to root domains
cags replied to watsmyname's topic in Apache HTTP Server
If you only have a finite number of subdomains you could do this using mod_rewrite. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} !^(www|mysub)\.mysite\.com RewriteRule .* http://www.mysite.com%{REQUEST_URI} [R=301] </IfModule> -
It's the s modifier that will make the . match newline characters, not the m.
-
You have the concept flipped on it's head. You don't rewrite www.page.com/?example to www.page.com/example/ you actually rewrite the opposite of that. Therefore you need to make all links on your page appear like the second version, and you need to make the mod_rewrite rules match the second version. So for example your rule might be... RewriteRule ^example/([0-9]+)/? /?example=$1 Your first rule rewrites requests for pages that don't have a file extension and adds .php to them and your second uses some code that irrelevant, but is close to being another method that will work for you.
-
Something like this should do the job... RewriteCond %{HTTP_HOST} ^ondb.pk$ RewriteRule .* http://downloads.ondb.pk%{REQUEST_URI} [R=301]