Configure ubuntu to use mod_rewrite

To enable mod_rewrite on Ubuntu is pretty easy what we have to do is, first we enable the apache module for mod rewrite with this line.

  1.  
  2. sudo a2enmod rewrite
  3.  

After that we have to edit the file /etc/apache2/sites-avalible/default, then we look for this:

  1.  
  2. <Directory /var/www/>
  3.     Options Indexes FollowSymLinks MultiViews
  4.     AllowOverride None
  5.     Order allow,deny
  6.     allow from all
  7.     # This directive allows us to have apache2’s default start page
  8.     # in /apache2-default/, but still have / go to the right place
  9.     #RedirectMatch ^/$ /apache2-default/
  10. </Directory>
  11.  

And then we replace “AllowOverride None” by “AllowOverride All”, this line tells apache to read the .htaccess file, that is the file where we will put our rewrite rules.

I have also taked out the MultiViews option since it was messing with my rewrite rules

  1.  
  2. <Directory /var/www/>
  3.     Options Indexes FollowSymLinks
  4.     AllowOverride All
  5.     Order allow,deny
  6.     allow from all
  7.     # This directive allows us to have apache2’s default start page
  8.     # in /apache2-default/, but still have / go to the right place
  9.     #RedirectMatch ^/$ /apache2-default/
  10. </Directory>
  11.  

finally we just reload apache

  1.  
  2. sudo /etc/init.d/apache2 restart
  3.  

now we have pretty urls for our sites. :)

Send a post request to a popup

Today i want to send the post request from a form to a pop up window and the solution is pretty simple first we have to create our form and then we add a target attribute where we specify the name that our popup window will have second we add a onsumbit call to the form that will popup the new window and submit the form we also have to assign and id to our form that will be usefull when calling the function that popup the windows

  1.  
  2. "index.php""post""windowName""return postPopup();""postForm"
  3.  "text""value1"
  4.  "text""value2"
  5.  <!– put all the form elements here –>
  6.  "submit"
  7.  
  8.  

  1.  
  2. <script type="text/javascript"// here we popup the new window, the second attribute have to be the same as the form target attribute
  3. , ‘windowName’, ‘width=800, height=400, resizable=yes, scrollbars=yes, toolbar=no, location=no, directories=no, status=no, menubar=no’ );
  4.         // we submit the form 50 milliseconds after so the browser creates the popup
  5.         setTimeout("document.getElementById(‘postForm’).submit();",50);
  6.         // we stop the regurar form submit

Real housewives write extensions.

One of the firefox extensions that i have installed is View Source Chart wich as said on the extension page “Draws A Color-Coded Chart of a Web Page’s Source Cod” what i like about it, is that it displays the html generated by javascript and the original code, not only the code viewable with the “view source” option.

i was using it when i realized that at the very bottom there is a hided message “Real housewives write extensions”, i attached an image of that message

viewsourcechart

What is this?

What is this all about?

Well i am a Mexican computer science engineer, focused on web development, i like to work with perl, php, css, xhtml, javascript, ajax, etc. and this will be my playground. Where i will put my experiences while i am working, learning and living from web development.

My first languaje is not english, so if something is not well written please let me know