how to write rewrite

only1wizard used Ask the Experts™
How do i rewrite this url to read in address bar as

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} !^*$      [NC]$
 22 RewriteCond %{HTTP_REFERER} !^$      [NC]$
 23 RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]$

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
kaufmedGlanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

mod_rewrite does not serve this purpose. You would need something like mod_seo (Helicon).
Top Expert 2010

Or you could simply add a new name based Virtual host definition, for " to the httpd.conf, with it's  DocumentRoot set to the B.../blog/ directory.


i already have a sub domain named

how would the virtual host benefit me?

when this is what im trying to achieve is this.

when i go to url

rewrite that url to

thanks in advance for your help!
AdamSenior Developer
To rewrite the page name, you can use something like this:

RewriteCond %{HTTP_HOST} ^blog\.example\.com$ [NC] <br>  
RewriteRule ^blog/blogs.php$ /blogs.php [NC,L]

This will make the file /blogs/blogs.php appear at the URL /blogs.php, but only for the blog.example domain

To change the domain name, you'll need to do a 301 redirect to move the user onto the other site:

RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] <br>  
RewriteRule ^blog/.?{REQUEST_URI} [R=301,L]  

This will take the user from to if the bath starts with /blog/
this is what i have working this is in my subdomain folders .htaccess

356 RewriteCond %{HTTP_HOST} !^blogs\.only1wizard\.com$
357 RewriteRule (.*)$1 [L,R=301]$
358 $

thanks for your help though!


Thanks for your help!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial