📄 htaccess.php
字号:
<?phpdefined('WikyBlog') or die("Not an entry point...");global $page,$pageOwner,$dbObject,$lang;$dbObject->links['htaccess'] = $page->formAction = '/Admin/'.$pageOwner['username'].'/htaccess';$dbObject->links['?'] = 'htaccess';$page->displayTitle = 'htaccess';if( $_SESSION['userlevel'] !== 4){ $page->contentA[$page->displayTitle] = 'You must be an administrator to access this page.'; return;}class htaccess{ function htaccess(){ global $rootDir,$page; $fileLocation = $rootDir.'/.htaccess'; ob_start(); // $mods = apache_get_modules(); //only since 4.3.2 // echo showArray($mods); // if( file_exists($fileLocation) ){ // message('file exists'); // } echo '<p>'; echo 'If you are using an Apache HTTP Server you may be able to take advantage of .htaccess files. '; echo 'Having an .htaccess file on your server enables url\'s that look like <tt>www.server.com/Main/Home</tt> instead of <tt>www.server.com/index.php/Main/Home</tt>.'; echo '</p>'; echo '<h3>How To</h3>'; echo '<ul>'; echo '<li>Create the file <tt>'.$fileLocation.'</tt> containing the following contents.</li>'; echo '<li>Test your installation and delete/modify your .htaccess file if needed.</li>'; echo '</ul>'; echo '<h3>.htaccess file</h3>'; echo '<textarea style="width:100%" rows="25" wrap="off">'; echo $this->getContents(); echo '</textarea>'; $page->contentA['htaccess'] = wb::get_clean(); } function getContents(){ global $wbConfig,$serverName3,$wbDirPrefix; $tab = "\t"; $t = array(); if(empty($wbDirPrefix) ){ $htaccessDir = '/'; }else{ $htaccessDir = addcslashes($wbDirPrefix,'.&$').'/'; } $t[] = '#WikyBlog generated .htaccess file'; $t[] = ''; // // Rewrite // $t[] = '<IfModule mod_alias.c>'; $t[] = $tab.'RedirectMatch permanent ^'.$htaccessDir.'$ '.$serverName3.'/'.$wbConfig['pUser'].'/Home'; $t[] = '</IfModule>'; $t[] = ''; $t[] = ''; // // Rewrite // $t[] = '<IfModule mod_rewrite.c>'; $t[] = $tab.'RewriteEngine On'; $t[] = ''; $t[] = $tab.'# Don\'t Rewrite For These filetypes'; $t[] = $tab.'# you may want to add other extensions like mp3|mpeg|wav|pdf|xml|txt'; $t[] = $tab.'RewriteCond %{REQUEST_URI} !\.(bmp|css|gif|ico|jpg|jpeg|js|png|shtml)$ [NC]'; $t[] = ''; $t[] = $tab.'# Don\'t Rewrite For Existing Files'; $t[] = $tab.'RewriteCond %{REQUEST_FILENAME} !-f [NC]'; $t[] = ''; $t[] = $tab.'# Don\'t Rewrite For Existing Directories Except for the root directory'; $t[] = $tab.'RewriteCond %{REQUEST_FILENAME} !-d [NC,OR]'; $t[] = $tab.'RewriteCond %{REQUEST_URI} ^'.$htaccessDir.'$'; $t[] = ''; $t[] = $tab.'RewriteRule .* wiki.php [L]'; $t[] = ''; $t[] = ''; $t[] = '</IfModule>'; // // php values // $t[] = ''; $t[] = ''; $t[] = '#php values'; $t[] = 'php_value magic_quotes_gpc 0'; $t[] = 'php_value magic_quotes_runtime 0'; $t[] = 'php_value magic_quotes_sybase 0'; $t[] = 'php_flag mbstring.func_overload off'; $t[] = 'php_flag register_globals off'; $t[] = ''; return implode("\n",$t); }}new htaccess();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -