The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Hiding php extension - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23) +--- Forum: UserSpice 4.4 (https://userspice.com/forums/forumdisplay.php?fid=27) +--- Thread: Hiding php extension (/showthread.php?tid=1447) |
Hiding php extension - MerajBD - 04-19-2019 Hello there, I am working on to hide php extension from my site. I am succeeded with htacces file. But the problem is usercake files are basically redirecting to their pages with php extension. How can I make usercake to redirect without php extension. Will editing redirect function work? RE: Hiding php extension - mudmin - 04-19-2019 I have not had much success hiding the file extension. I'm sure it can be done, but it creates all sorts of problems. RE: Hiding php extension - mudmin - 04-19-2019 I will say that this is the closest I can get quickly to it working... RewriteEngine on #unless directory, remove trailing slash RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /4408/$1 [R=301,L] #redirect external .php requests to extensionless url RewriteCond %{THE_REQUEST} ^(.*)\.php([#?][^\ ]*)?\ HTTP/ RewriteRule ^(.*)\.php$ /4408/$1 [R=301,L] #resolve .php file for extensionless php urls RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ /4408/$1.php [L] But from there you would need to figure out how to make php functions actually work. If you find out, let me know! Btw, the 4408 is the folder that my project was in. Normally you can move userspice from folder to folder without breaking anything and this would take that feature away. RE: Hiding php extension - MerajBD - 04-19-2019 Quote:But from there you would need to figure out how to make php functions actually work. If you find out, let me know!Sorry for my inappropriate question, but what did you mean by that? Can you please explain? Don't mind me RE: Hiding php extension - mudmin - 04-19-2019 So if you use the sample I gave you and put the right folder in there, your pages will load and everything will "look" decent" but for me, login didn't work etc. So I know it that's close, but something is still broken. RE: Hiding php extension - MerajBD - 04-19-2019 Oh, I already have my htacces working, Code: DirectoryIndex index default Code: class Redirect { I have a suggestion: You can add a option in confi called "file extension for urls". As user define their preferred extension e.g.: php, html, (empty for no extension) and you can rewrite your files and replace somthing like Code: <a href="<?=$abs_us_root.$us_url_root.'users/account'.$file_ext.''?>">Account</a> |