How to keep url_suffix from automatically being appended to links?

#1
[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

#2
[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...

#3
[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

#4
[eluser]Colin Williams[/eluser]
Good call, Mirage. CI Routing might be a bit more hassle-free than a tricky mod_rewrite.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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