1

I have a problem with my website. I have a domain abc-xyz.com and I was uploaded source into a directory like name /folder . Ok, I can visit website by abc-xyz.com/folder . But problem detected. I need rewrite URL! Because root directory running another website, i want to rewrite URL for childrent directory /folder . And "http://abc-xyz.com/folde/r" is a string. So i was try:

RewriteBase /
RewriteCond %{HTTP_HOST} !^abc-xyz\.com$ [NC]
RewriteRule ^(.*)$ http://abc-xyz.com/test/folder/$1 [R=301,L]

but it not workly. when i visit http://abc-xyz.com/test/folder/ . It direct to abc-xyz.com (and it's a another website).

Thanks for read, and please help me. Sorry because my English very bad :(

  • Yes. when you visit http://examp.com/folder/index.php/?act=dosomething&u=12 I need it rewrite examp.com/folder/dosomething/12 . Same it! – Zinji Linh Nguyen Mar 05 '15 at 16:49

1 Answers1

0

From what I understand, you want to redirect all requests into a subdirectory of a site?

e.g.

http://abc-xyz.com/something.txt goes to http://abc-xyz.com/folder/something.txt

http://abc-xyz.com/directory/file.txt goes to http://abc-xyz.com/folder/directory/file.txt ?

Does the solution from this page work for you (which I've edited slightly below)?

https://stackoverflow.com/a/3414030/3944304

RewriteEngine on
RewriteRule !^folder($|/) http://abc-xyz.com/folder/%{REQUEST_URI} [L,R=301]
Community
  • 1
  • 1
CT14.IT
  • 1,635
  • 1
  • 15
  • 31
  • I have 2 site separate. I want to rewrite URL for a website in a subfolder. And file .htaccess only rewrite in it, Exam: exam.com/test/index.php/?something=abc&uid=11 --> exam.com/test/something/abc/11 <== it good (.htaccess at subfolder). When i visit exam.com/index.php/?nothing=xyz&uid=1 --> exam.com/nothing/xyz/1 <== i written it ok. But i don't know write for subfolder :( – Zinji Linh Nguyen Mar 05 '15 at 16:57
  • Sorry, I don't quite think I follow. You might want to untick my post, so that others will come looking as well. – CT14.IT Mar 05 '15 at 17:03
  • don't worry. I very thankful for the help of you. Have a nice day to you – Zinji Linh Nguyen Mar 05 '15 at 17:06