Domain name rewriting and URL rewriting in the meantime in .htaccess

Posted by Steven on Server Fault See other posts from Server Fault or by Steven
Published on 2010-03-20T04:40:11Z Indexed on 2010/03/20 4:41 UTC
Read the original article Hit count: 798

Ugly URLs:

 www.domainname.com/en/piece/piece.php?piece_id=1
 www.domainname.com/en/piece/piece.php?piece_id=2
 www.domainname.com/en/piece/piece.php?piece_id=3
 ...

Friendly URLs:

piece.domainname.com/en/1
piece.domainname.com/en/2
piece.domainname.com/en/3 
...

I want to present website users only friendly URLs. When I apply

RewriteEngine On
RewriteRule ^en/([^/]*)$ /en/piece/piece.php?piece_id=$1 [L]

only the URL is rewrote.Besides the CSS file can not be found in web page of the friendly URL. How to rewrite the domain name and the URL in the meantime?

Do I have to use RedirectMatch, if so, how to do it?

© Server Fault or respective owner

Domain name rewriting and URL rewriting in the meantime in .htaccess

Posted by Steven on Server Fault See other posts from Server Fault or by Steven
Published on 2010-03-20T00:39:46Z Indexed on 2010/03/20 5:01 UTC
Read the original article Hit count: 798

Ugly URLs:

 www.domainname.com/en/piece/piece.php?piece_id=1
 www.domainname.com/en/piece/piece.php?piece_id=2
 www.domainname.com/en/piece/piece.php?piece_id=3
 ...

Friendly URLs:

piece.domainname.com/en/1
piece.domainname.com/en/2
piece.domainname.com/en/3 
...

When I apply

RewriteEngine On
RewriteRule ^en/([^/]*)$ /en/piece/piece.php?piece_id=$1 [L]

only the URL is rewrote.Besides the CSS file can not be found in web page of the friendly URL. How to rewrite the domain name and the URL in the meantime?

Do I have to use RedirectMatch, if so, how to do it?

© Server Fault or respective owner

Related posts about apache

Related posts about .htaccess