Link to home
Start Free TrialLog in
Avatar of only1wizard
only1wizardFlag for United States of America

asked on

how to write rewrite

How do i rewrite this url http://www.example.com/blog/index.php to read in address bar as http://blog.example.com/index.php?

thanks in advance for your help!


1 # Use PHP5CGI as default$$
  2 AddHandler fcgid-script .php$$
  3 $$
  4 DirectoryIndex index.php$$
  5 $
  6 Options -Indexes +FollowSymLinks$$
  13 RewriteEngine on$
 14 $
 21 RewriteCond %{HTTP_REFERER} !^http://www.example.com/.*$      [NC]$
 22 RewriteCond %{HTTP_REFERER} !^http://www.example.com/blog/$      [NC]$
 23 RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]$

Open in new window

Avatar of kaufmed
kaufmed
Flag of United States of America image

mod_rewrite does not serve this purpose. You would need something like mod_seo (Helicon).
Or you could simply add a new name based Virtual host definition, for "blog.example.com/ to the httpd.conf, with it's  DocumentRoot set to the B.../blog/ directory.
Avatar of only1wizard

ASKER

i already have a sub domain named blog.example.com

how would the virtual host benefit me?

when this is what im trying to achieve is this.

when i go to url http://www.example.com/blogs/blogs.php?BlogId=1&FriendId=1

rewrite that url to http://blog.example.com/blogs.php?BlogId=1&FriendId=1

thanks in advance for your help!
SOLUTION
Avatar of Adam
Adam
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your help!