ezis Posted March 25, 2012 Report Share Posted March 25, 2012 (edited) http://domain/directory/ iekš RewriteBase /directory/ nākas rakstīt manuāli. Ir kāds veids kā to izdarīt automātiski? Tādas aizdomas, ka nav. Nespēju atrast atbildi! Edited March 25, 2012 by ezis Quote Link to comment Share on other sites More sharing options...
KasparsK Posted March 26, 2012 Report Share Posted March 26, 2012 .htaccess RewriteEngine On RewriteCond %{REQUEST_URI} !\.(css|png|js|jpg|gif|jpeg|avi|mp3) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?p=$1 [QSA,L] Šito iemet lapas galvenajā failā Saliec masīvā kuras lapas tu vēlies, lai darbojas lapā, respektīvi tev viņš pārveidos uz http://domain.lv/login/ vai /directory/ $allowed_site_pages = array( 'directory', 'login', ); Un arī šito $model_to_load = 'dashboard'; // Default site page $model_requested = ''; if( isset( $_GET['p'] ) AND !empty( $_GET['p'] ) ) { $params = explode( '/', $_GET['p'] ); $model_requested = strtolower( $params[0] ); } if( !empty( $model_requested ) AND in_array( $model_requested, array_keys( $allowed_site_pages ) ) ) { $model_to_load = $model_requested; } else { $model_requested = $model_to_load; } Pēdējais valsis if( !file_exists( '/pages/' . $model_to_load . '.php' ) ) { $model_to_load = '404'; } ob_start(); include '/pages/' . $model_to_load . '.php'; ob_end_flush(); Tas būtībā ir viss, ceru ka saprati. Kaspars. Quote Link to comment Share on other sites More sharing options...
ezis Posted March 26, 2012 Author Report Share Posted March 26, 2012 Sapratu, bet tas nav tas, ko meklēju! Tik un tā, paldies par atbildi (: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.