Jump to content

alex3

Members
  • Posts

    74
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

alex3's Achievements

Member

Member (2/5)

0

Reputation

  1. Had been unbelievably stupid and was editing the wrong .htaccess for a start (SO stupid). Once I was editing the right one, removing the slashes worked, thank you so very much indeed
  2. It would appear that because you're rewriting all traffic to .html files to index.php, you're rewriting the image to the html file, and then this is being rewritten to the php file, per the last RewriteRule. If you're saying this behaviour is unwanted, try using the last rule flag [L].
  3. Little bump, help still needed
  4. Hi, I have this rewrite rule that detects if my VPS is being accessed via it's IP rather than an FQDN: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^12\.123\.123\.123 RewriteRule ^/(.*)$ http://hostname.domain.tld/$1 [R=301,L] </IfModule> And I have this as the hostname entry in my VHosts file for domain.tld: <VirtualHost *:80> # VHost for VPS info ServerName hostname.domain.tld ServerAlias hostname.domain.tld DocumentRoot /home/username/www/domain.tld/public/hostname </VirtualHost> When I visit 12.123.123.123 in my browser, I get shown the index.html of the hostname dir, but I don't get a hard redirect (as I believe I should with R=301), but I still see the IP in the address bar. I can't find any reason why the flags should be ignored, so why is the RewriteRule being carried out, but the flag ignored? Any help is immensely appreciated! Cheers, Alex
  5. I managed to fiddle about and got a similar result to what you got, works perfectly, very pleased indeed with it. Thanks enormously for your help Here's my finished .htaccess, for prosperity: <IfModule mod_rewrite.c> RewriteEngine On # Change this for your own path RewriteBase / # This is for when user is reviewing order RewriteCond %{QUERY_STRING} ^token=(.*)&PayerID=(.*)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1/%1/%2? [L] # This is for when the user cancels the order from the PayPal interface RewriteCond %{QUERY_STRING} ^token=(.*)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1/%1? [L] # This one is for all others RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1/%1/%2? [L] </IfModule> <IfModule !mod_rewrite.c> ErrorDocument 404 /index.php </IfModule> And then with CodeIgniter grabbing the values is just as you would normally, method($token, $paypal_id).
  6. Hi, It seems I'm trying to do the opposite of what most people want to do with mod_rewrite, and as such I can't find a thing on it. I'm running a CodeIgniter site, with this .htaccess already implemented and working fine: Options +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] </IfModule> <IfModule !mod_rewrite.c> ErrorDocument 404 /index.php </IfModule> The problem is that sometimes I get URLs like these two, when dealing with PayPal: http://sub.domain.com/controller/method/?token=value1 http://sub.domain.com/controler/method/?token=value1&PayerId=value2 What I'm after is to convert these URLs in to this form http://sub.domain.com/controller/method/value1 http://sub.domain.com/controller/method/value1/value2 (I either get one two GET variables, one when the method is 'cancel', and two when the method is 'review'.) So, obviously my current rule takes what ever is after the .com/ and gives it to index.php, which then processes it, this seems to be the most common .htaccess usage. I want to do the reverse of this (capture the GET variables). This seems to require a RewriteCond (because RewriteRule ignores GET variables, so you can't capture them using it), in addition to a RewriteRule, but I don't know how to pass the GET variables I capture in to the new URL. This seems overly complex, even pointers in the right direction would be immensely appreciated, this is driving me insane! Cheers, Alex
  7. Hi, I'm running CodeIgniter with this htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> <IfModule !mod_rewrite.c> ErrorDocument 404 /index.php </IfModule> The problem is PayPal, which uses GET requests to transmit information during Express Checkout. When a customer cancels an order, they go to basket/review/?token=Something&PayerID=SomethingElse. This works fine. What does not work is when the user cancels the PayPal transaction, in which case PayPal transfers them to basket/cancel/?token=Something. I've isolated the issue, and it is resolved if &Anything is appended to the URL. So, basically, I want to scan for GET requests, and then add &A to the end of them. I really don't know how to do this, particularly with my existing rewrite rule. Either that, or transform all GET request in to the manner described in the title, such as with a hard 301 redirect. Any help is greatly appreciated. Cheers, Alex
  8. Err... I'd star out those db connection details...
  9. Doesn't mysql_fetch_array() only return a numerical array (eg. $r[1], $r[2], $r[3])? The way you're trying to assign the variables in the loop look more like you should be using mysql_fetch_assoc($result).
  10. Your code from both pages would be helpful. Are you starting the session in both pages? session_start();
  11. The problem is you're trying to serve two different types of content on one page. The headers you're sending to the web browser basically say "I'm sending you a PDF file, and I'm going to start outputting it now". After this declaration, you've got HTML, which isn't what the browser is expecting (and rightly so, because you've told it otherwise). So the browser downloads the file, and behaves like it would if you were linking directly to a zip file or something. Try it, create a little HTML page with an anchor link to something that the browser can't display natively (so no images, audio/movie files etc.) and you'll see exactly the same behaviour: the browser starts the download, but stays on the page with the link.
  12. I have a cookie with three values: $_COOKIE['Site Name']['session'],['token'],['user'] If a user wants to be remembered, a unique token is generated and added to the users row in a DB. When a user revisits the site (revisit = after the user's previous session ID has expired) the token and username values are looked up in the DB, if they exist the user is trusted and a session value is created (equal to session_id()) in the cookie. The session value is the first thing to be checked to prevent lots of DB lookups. If the session value is equal to session_id(), the user is trusted, if not then we check the values of 'user' and 'token'. The crux is that whenever the token value is looked up, it is replaced with a new value (to prevent cookies being stolen and used). I want to update the user's cookie to reflect this new token value, but I don't know how to while keeping the cookie expiry date intact. How can I do this?
  13. I've a had a system problem and can only access the hard drive, not the OS (I can't boot in to it). I can access what I think is my old database. It's OS X I can't access, but I can see the drive contents in Ubuntu. Using MAMP, I've found the DB in /Applications/MAMP/db/mysql/database_name. The permissions on this folder are such that I can't see it's contents in nautilus but using ls in the terminal I can see a db.opt file, and three files for each table in the database, in this form: table_name.frm, table_name.MYD, table_name.MYI. How can I recover the data in these files and put them in a new database? Ideally, I'm looking to 'convert' these files in SQL commands I can just put into phpMyAdmin and recreate the tables.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.