htaccess rewrite url - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: htaccess rewrite url (/showthread.php?tid=55278) |
htaccess rewrite url - El Forum - 10-18-2012 [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? htaccess rewrite url - El Forum - 10-18-2012 [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. htaccess rewrite url - El Forum - 10-19-2012 [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 htaccess rewrite url - El Forum - 10-19-2012 [eluser]ppwalks[/eluser] In essence its just masking 1 folder name in url but accessing through the same path... htaccess rewrite url - El Forum - 10-19-2012 [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. |