Creating a virtual directory or convert url query string to a directory using .htaccess

Posted by admin

Using mod_rewrite or .htaccess will help your site URL a much more Search Engine Friendly URL by converting the URL query string to a directory like this http://mysite.com/index.php?page=gallery&task=view to http://mysite.com/gallery/view/. Simply name the directory by the name of the value of your GET variable on your url. Also you can get the value of the URL by calling the name of the variable on the url that you have represent. So place the code inside your .htaccess file.

# put this .htaccess file to your site root directory #

Options +FollowSymLinks
# start the Rewrite Engine or Rewrite Mode #
RewriteEngine On

# convert the directory type url to url query #
# "$1" is a variable to set the value of "folder" #
RewriteRule ^([a-zA-Z0-9_\\s-]+)(/)?$ index.php?folder=$1

Back to List | Comments (0) | October 03, 2009 at 03:29 pm

0 Responses

No Records Yet.

Leave a Reply

Name (required)

Email (required) will not be publish

Website (optional) ex: http://www.domain.com

Notify me of followup comments via e-mail. (optional)

Your Message (required)

Enter Security Code (required)
captcha  

Latest News (2)

iWebProvider.com No 1 at Yahoo search engine for the keyword -filipino web developer.

Posted on October 02, 2009

On Sept 6, 2009 iWebProvider.com is No. 1 at Yahoo and Google for keyword "filipino web developer".

continue reading

Launching of the updated iWebProvider.com

Posted on October 02, 2009

Now as of July 7, 2009 the launching of iWebProvider.com with its improve feature and the used of its very own CMS. It now has features like Blogs, comments on News articles and the upcoming user registration.

continue reading

Wise Words

"It's not about how many you have learned but how much you have utilized and mastered what you have learned."

- by: Mark Lester
Get subscribers