Jump to content

Rebelrebellious

Members
  • Posts

    78
  • Joined

  • Last visited

    Never

Everything posted by Rebelrebellious

  1. So at this point it is mostly working. RewriteCond $1 ^public/(.+)$ RewriteCond %1 ^(.*)\.(.+)$ RewriteCond %1 !^.*/.*$ #RewriteCond %1 !/ RewriteRule ^(public/.+)$ public/%2/%1.%2 [L,E=REWRITE:%{ENV:REWRITE}-$1] # send almost everything to the main program file # prevent the request from going to the main program if the file exists in public/ RewriteCond $1 !^public/.*$ RewriteCond $1 !^main\.php$ RewriteRule ^(.*)$ /main.php [L,QSA,E=REWRITE:%{ENV:REWRITE}-$1] Is there any way to do away with RewriteCond $1 !^main\.php$ ?
  2. Okay. I finally got the first part working. Hopefully the rest comes together quickly. # allow requests for public files to go through RewriteCond $1 ^public/(.+)$ RewriteCond %1 ^(.*)\.(.+)$ RewriteCond %1 !^.*/.*$ #RewriteCond %1 !/ RewriteRule ^(public/.+)$ public/%2/%1.%2 [NC,L,E=REWRITE:%{ENV:REWRITE}-$1]
  3. Thanks. I thought that the / indicated the base path for the website, but based on apache behavior you seem to be correct.
  4. So to simplify the problem, I have commented out everything except: # allow requests for public files to go through #RewriteCond $1 ^%{DOCUMENT_ROOT}/public/.+ [NC] RewriteCond $1 !^%{DOCUMENT_ROOT}/public/.+/.*\..+$ [NC] RewriteRule ^public/(.*)\.(.+)$ /public/$2/$1.$2 [NC,L,E=REWRITE:%{ENV:REWRITE}-public/$1.$2] if I request http://domain/public/ I get 403 Forbidden if I request http://domain/public/favicon.ico I get 500 if I request http://domain/public/ico/favicon.ico I get 500 Please help me work through this.
  5. You may not need to go through mod_rewrite. Does this help? http://php.net/manual/en/function.getenv.php getenv('username')
  6. Sorry, I think this may be better: RewriteRule ^/provincial/bc/(.*)$ /$1 [NC,L] or if that doesn't work, try: RewriteRule ^provincial/bc/(.*)$ /$1 [NC,L] I am curious about which solution works.
  7. You should mark this as solved. I understand that your discovery is that multiviews supercedes mod_rewrite and doesn't even attempt to rewrite the solution it finds. That's good to know. As an aside, would you script be improved by adding a / to the beginning of your regex so? RewriteRule ^/info/([a-z]+)/?$ info.php?page=$1 [NC,L] Or doesn't that work at all? Shouldn''t the request be starting with /?
  8. But add the dynamic part and remove the Redirect flag: RewriteRule http://www.domainname.com/provincial/bc/(.*) http://www.domainname.com/$1 [NC,L]
  9. I think that you need to stop the last one from happening to the requests that you have already changed. Even though you specified Last, the .htaccess file is reprocessed for each sub directory(I think) so: RewriteCond %{SCRIPT_NAME} !\.php RewriteRule ^cp[/]*?$ _cp/$1 [L] RewriteRule ^css/(.*)$ /_inc/css/$1 [L] RewriteRule ^js/(.*)$ /_inc/js/$1 [L] RewriteRule ^img/(.*)$ /_inc/img/$1 [L] RewriteRule ^files/(.*)$ /_user/files/$1 [L] RewriteCond $1 !^(_cp/|/_inc/css/|/_inc/js/|/_inc/img/|/_user/files/) RewriteRule ^(.*)$ index.php?page=$1 [L,QSA] Also, if you want that first RewriteCond to stop all php requests then you may want add a rule to skip the next 5 RewriteRules. RewriteCond %{SCRIPT_NAME} !\.php RewriteRule - [s=5] RewriteRule ^cp[/]*?$ _cp/$1 [L] RewriteRule ^css/(.*)$ /_inc/css/$1 [L] RewriteRule ^js/(.*)$ /_inc/js/$1 [L] RewriteRule ^img/(.*)$ /_inc/img/$1 [L] RewriteRule ^files/(.*)$ /_user/files/$1 [L] RewriteCond $1 !^(_cp/|/_inc/css/|/_inc/js/|/_inc/img/|/_user/files/) RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]
  10. Are you looking for a rewrite or a redirect? I think that you may need to use the QSA flag to append your new query to the old query. That space between the carat and the willmott is not good. If that doesn't work, check in your error logs (found in cpanel, or wherever you keep them) for a clue. for rewrite: RewriteRule ^willmott index.php?option=com_content&view=article&id=130:paul-a-vanessa-willmott&catid=36:full-time-evangelists&Itemid=56&authid=91 [L,QSA,R] for redirect just remove the R flag: RewriteRule ^willmott index.php?option=com_content&view=article&id=130:paul-a-vanessa-willmott&catid=36:full-time-evangelists&Itemid=56&authid=91 [L,QSA]
  11. Does this work? RewriteEngine On RewriteRule !(\.swf|\.gif|\.png|\.jpe?g|\.css|\.js|\.php|\^public/|^admin/.*)$ index.php [nocase,last]
  12. After making some changes I am now getting my main.php. The main.php should not be coming up because the file favicon.ico should be found after the first rewrite succeeds (which isn't happening) and the second rewrite prevents the third rewrite from happening. Here is the current script: # allow requests for public files to go through RewriteCond $1 ^/public/ [NC] RewriteCond $1 !^/public/.+/.*\..*$ [NC] RewriteRule ^/public/(.*)\.(.*)$ /public/$2/$1.$2 [NC,L,E=REWRITE:%{ENV:REWRITE}-public/$1.$2] # prevent the request from going to the main program if the file exists in public/ext/ RewriteCond $1 ^public/(.*)$ #RewriteCond %{REQUEST_FILENAME} -f [NC] RewriteCond $1 -f [NC] RewriteRule .* - [L] # send almost everything to the main program file RewriteCond $1 !^main\.php$ [NC] #RewriteCond $1 !^/public/(.*)$ [OR] #RewriteCond $1 !-f #RewriteRule (.*) /main.php [L,QSA,E=REWRITE:%{ENV:REWRITE}-$1] RewriteRule ^(.*)$|^$ /main.php [L,QSA,E=REWRITE:%{ENV:REWRITE}-$1]
  13. Although the file http://domain.net/public/ico/favicon.ico exists the following instructions give me a 500 when I request http://domain.net/public.ico # allow requests for public files to go through RewriteCond $1 ^/public/ [NC] RewriteCond $1 !^/public/.*/.*\..*$ [NC] RewriteRule ^/public/(.*)\.(.*)$ /public/$2/$1.$2 [N,NC,E=REWRITE:%{ENV:REWRITE}-public/$1.$2] # prevent the request from going to the main program if the file exists in public/ext/ RewriteCond $1 ^/public/(.*)$ RewriteCond %{REQUEST_FILENAME} -f [NC] #RewriteCond $1 -f [NC] RewriteRule .* - [L] # send almost everything to the main program file RewriteCond $1 !^/main\.php$ [NC] #RewriteCond $1 !^/public/(.*)$ [OR] #RewriteCond $1 !-f RewriteRule (.*) /main.php [L,QSA,E=REWRITE:%{ENV:REWRITE}-$1] I've been struggling with this for way too long. Please help,
  14. Hey Xylex, thanks. I hope you are right because the schedule I am working with is packed solid.
  15. Thanks for the input Waynewex, but I'm not catching the relevancy of your post. For my own purposes I am estimating that with a two class per semester load I should set aside 30 hours per week. I'm making no guarantees that this is realistic, but it is the sort of number I wanted.
  16. Thanks. Although there are variables, it seems to me that there must be a mode answer. My understanding is that many of these programs are set up so that a student will be taking two classes at any given point in time. Regarding the quality of such an education, having graduated from a state university, I am convinced that the whole of the education business is a fraud from grade school through the university. It is up to me to learn, but I can't issue myself a diploma. Since I am working full time and living check to check I can't afford to go back to school full time, nor would I want to (unless it is with a very prestigious school where I still have some faith that they are providing something of value). It suits me much more to actually do something while I am continuing to learn. That said, I could still change my mind.
  17. Do you know how much time a person should set aside for coursework when working towards a degree at an online university? I'm not looking for guesses. If you have done it, or if you know someone firsthand it would be awesome if you could share your insight. Thanks for reading,
  18. That helps a lot. Now I have a better concept of what situation calls for what approach. Thank you,
  19. Thanks everyone. I am looking forward to reading your wisdom on Monday. Have a great weekend.
  20. I'm not sure if there is a dependency. Whether I use case A, B, or C the function is still in object one. The point of object two is that I only need to instantiate the biggest object on the page that has the display stuff on it. So my page can be something like: <html> ... <body> <?php include_once 'file containing two'; $two = new two; ?> </body> </html> Two is sort of like a zoo and one is like a gorilla. two gives me access to all the zoo functions and the cow gorilla interaction functions and the gorilla functions. I could instantiate a gorilla in the display page and get its functions directly but I am thinking that it makes more sense to interact with either zoo->gorilla_function() or zoo->gorilla->gorilla_function(); Does this make sense?
  21. Well we are getting somewhere. In both cases I am using the object $two as the object that handles all of the logic. two works with one and a bunch of other objects within its functions. In this situation however, two merely needs to present ones function without doing anything with the results. I could go straight to one and bypass two as a case C. Thanks again everyone.
  22. You may want to imagine the word 'one' = 'part' and the word 'two' = 'whole' or some similar analogy.
  23. Thanks for taking the time to help me with this. I am amused that you can't imagine that the function in class one does something. I think you are amused because you can. I'll humor you a little further. <?php // A class one(){ protected $type; function __construct($type){ $this->type = $type; } function f(){ // query the database about one and return specific information about f where type } } class two(){ function f(){ $one = new one('example'); $one->f(); } } $two = new two(); $two->f(); ?> <?php // B class one(){ protected $type; function __construct($type){ $this->type = $type; } function f(){ // query the database about one and return specific information about f where type } } class two(){ public $one; function __construct(){ $this->one = new one('example'); } } $two = new two(); $two->one->f(); ?>
  24. Okay, I am not trying to ask about proper syntax here. I am asking about the approach to calling a class function by way of an intermediate object. The code was thrown together, poorly, to demonstrate the situation in a general way. Here is another revision. <?php // A class one(){ function f(){ } } class two(){ function f(){ $one = new one(); $one->f(); } } $two = new two(); $two->f(); ?> <?php // B class one(){ function f(){ } } class two(){ public $one; function __construct(){ $this->one = new one(); } } $two = new two(); $two->one->f(); ?>
  25. Thanks for taking a look Shlumph. By your logic I would actually expect to choose the opposite approaches to the respective goals. If i were always going to call one then I may as well just include it and call it as such. If I take approach A however I am only creating one if I need it and I have the option of changing method two to pull a different function altogether. Why do you suggest the opposite? Daniel0, You are right. I was just choosing the names for convenience, but they would be treated as constructors. In my actual program, the functions are named differently, they are not constructors. And now i understand why Shlumph thought the opposite. Let me modify the question.. Which is better? <?php // A class one(){ function f(){ } } class two(){ function f(){ $one = new one(); $one->f(); } } $two = new two(); $two->f(); ?> <?php // B class one(){ function f(){ } } class two(){ $one; function f(){ $this->one = new one(); } } $two = new two(); $two->one->f(); ?> Thanks,
×
×
  • 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.