• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
htaccess rewrite url

#1
[eluser]ppwalks[/eluser]
just wondering if it is possible to rewrite a url structure but keep paths in tact.

I have 2 urls (example) -

www.example.com/test/

www.example.com/other/

what I would like to do is rewrite test to other but still be able to access all the sub directories of test. So:

www.example.com/test/dir/
www.example.com/test/dir1/

would reside to

www.example.com/other/dir/
www.example.com/other/dir1/

Hence change url but retain path, is this possible?

#2
[eluser]Aken[/eluser]
Code:
RewriteRule ^test(/.*)?$ other$1

URL will be example.com/test/whatever/here, but will look for example.com/other/whatever/here. Should get you started.

#3
[eluser]ppwalks[/eluser]
Did not work, basically I have a splash page that I want to override the main index file of another folder with an index but it will reside to the sql query after the call.

splash page url: www.example.com/dir/

other folder url: www.example.com/dir1/

So basically if you land on www.example.com/dir1/ it will reside to www.example.com/dir/ but any sub folders of www.example.com/dir1/index.php?cPath=1 it will reside to www.example.com/dir/index.php?cPath=1 and not just show the splash page again. hope this is clearer.

thanks all

#4
[eluser]ppwalks[/eluser]
In essence its just masking 1 folder name in url but accessing through the same path...

#5
[eluser]Aken[/eluser]
The rule I gave you will take any URL starting with example.com/test, and look for the same URL but instead inside example.com/other

example.com/test => example.com/other
example.com/test/index.htm => example.com/other/index.htm
example.com/test/subfolder/query/page.php?query=true => example.com/other/subfolder/query/page.php?query=true

If something isn't working, post your .htaccess file, your directory structure, and what result you're getting. "Did not work" doesn't help.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.