Now look at the two url given below
So kindly replace the first 6 lines in actions.php with the following lines.
- http://localhost/stupid/index.php?module=blogs&sub=editblog&action=save
- http://localhost/stupid/blogs/editblog/save
- Create a file in the root directory of your website (in our case 'stupid' directory)
- Name it as '.htaccess'.Edit the file using notepad.
<FilesMatch "\.php$">In order to distinguish the action parameter within a module from user actions like login,register etc,the url variable 'action' previously used in actions.php in actions folder will be replaced by 'u_action'.
Order Allow,Deny
Deny from all
</FilesMatch>
<FilesMatch "index[0-9]?\.php$">
Order Allow,Deny
Allow from all
</FilesMatch>
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)\=([a-zA-Z0-9_-]+)$ index.php?module=$1&sub=$2&action=$3&$4=$5
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?module=$1&sub=$2&action=$3
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)\=([a-zA-Z0-9_-]+)$ index.php?module=$1&sub=$2&$3=$4
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?module=$1&sub=$2
RewriteRule ^action\=([A-Za-z0-9\_\-\/]+)$ index.php?u_action=$1
RewriteRule ^([A-Za-z0-9\_\-\/]+)/$ index.php?module=$1
So kindly replace the first 6 lines in actions.php with the following lines.
global $user;Now you can set the action of login form as
if(isset($_GET['u_action']))
{
$action=$_GET['u_action'];
switch($action)
<?=BASE?>/action=loginSo we are done with url rewriting.In the next post we will be creating a blog module.
Hello AZYCRAZE! In how many parts is this turorial will be ended?
ReplyDeleteThanks!!!
Just few more
ReplyDeletecreating a blog module,
creating an admin interface.
Suggestions for enhancing site look,security,etc.