开发者

.htaccess - write a clean URL

开发者 https://www.devze.com 2023-02-13 09:49 出处:网络
I want to write a clean URL for my application. I searched and have written following, but it does not work and gives \"Server not found error\".

I want to write a clean URL for my application. I searched and have written following, but it does not work and gives "Server not found error".

I have URL like this

 http://localhost/projectFolder/user_folders/userName/testSite2/

and I want it to be -

开发者_开发百科  http://testSite2.mySystemDomain.com/

I have tried as follows, but it fails.

RewriteEngine on
RewriteRule ^/user_folders/userName/testSite2/(.*) http://testSite2.mySystemDomain.com/$1

EDIT

There will be number of sites like testSite2. I need to write the URL for each such site.


Put this in .htaccess in folder projectFolder

RewriteEngine on
RewriteRule ^user_folders/(.*)/(.*) http://$1.mySystemDomain.com/$2 [R=301,L]
0

精彩评论

暂无评论...
验证码 换一张
取 消