Log in

View Full Version : .htaccess Rewrite URL



thanhnguyen
05-08-2007, 08:24 AM
Hello guys,

I am trying to rewite URl: http://mydomain.com/member.php?member=ABC

into http://ABC.mydomain.com (better) or http://mydomain.com/ABC but could not. So can you help me with this, I use these sentences:

RewriteEngine on
RewriteRule ^.htaccess$ -f
RewriteCond %{HTTP_HOST} !^www.domain.info
RewriteCond %{HTTP_HOST} ^([^.]+).domain.info
rewriteCond http://www.domain.info/member.php -d

but it does not work

I use Blog system of 6al.net

thanks,

Thanh Nguyen

mwinter
05-08-2007, 03:58 PM
I am trying to rewite URl: http://mydomain.com/member.php?member=ABC

into http://ABC.mydomain.com (better) or http://mydomain.com/ABC but could not.

The Apache documentation (http://httpd.apache.org/docs/2.2/) includes a URL rewriting guide (http://httpd.apache.org/docs/2.2/misc/rewriteguide.html), containing examples for producing canonical URLs and host names (http://httpd.apache.org/docs/2.2/misc/rewriteguide.html#url). However, these rewriting rules can only be applied using the core server configuration, not through distributed configuration files (.htaccess). Therefore, if you cannot modify the server configuration, or persuade your host to do so, you will not be able to achieve the effect you want.



RewriteRule ^.htaccess$ -f

This rule should be redundant: the server configuration should already deny access to any file beginning ".ht". If it doesn't, use a Files or FilesMatch directive to deny access, not mod_rewrite.

Mike

thanhnguyen
05-09-2007, 02:45 AM
Thanks,

I got this


Options +FollowSymLinks +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^([^.]+)$ member.php?member=$1 [L]


It works

Thanh Nguyen