How to keep url_suffix from automatically being appended to links? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How to keep url_suffix from automatically being appended to links? (/showthread.php?tid=11430) |
How to keep url_suffix from automatically being appended to links? - El Forum - 09-08-2008 [eluser]Isos[/eluser] Hi! I am using $config['url_suffix'] = '.php' in my config file. The need is that some payment websites require an extension to the redirect link, which solved the problem. However, I am getting .php appended to almost every link on my website! I guess they are only the links that utilize anchor() function. please tell me, is there a way to disable that? Thanks How to keep url_suffix from automatically being appended to links? - El Forum - 09-08-2008 [eluser]Colin Williams[/eluser] Hrm... the fact that anchor() appends this is probably, generally, a good thing. Since the ".php" extension existence is the requirement of an outside service, it might make sense to re-engineer your setup to only react to that one condition, probably through mod_rewrite rules. Changing this line in your .htaccess or httpd.conf from Code: RewriteRule ^(.*)$ /index.php/$1 [L] to Code: RewriteRule ^(.*)(\.php)?$ /index.php/$1 [L] might do the trick, but you probably have to go to greater lengths to get it to work, and might want to specifically single-out the requesting server that requires the ".php" extension. Basically you're saying, "route anything like xxxxx.php to index.php/xxxxx." Don't know if this would mess up the valid index.php requests or not... How to keep url_suffix from automatically being appended to links? - El Forum - 09-08-2008 [eluser]Mirage[/eluser] I would simply add .html to the requests that need it and address this either in .htaccess or with a with a route. .htaccess: In .htaccess if the extension is .html and rewrite to the the stripped version or routes.php: $routes[(my/specific/redirect/link).html]=$1; // or fancier... Cheers, -m How to keep url_suffix from automatically being appended to links? - El Forum - 09-08-2008 [eluser]Colin Williams[/eluser] Good call, Mirage. CI Routing might be a bit more hassle-free than a tricky mod_rewrite. |