登录 | 注册 | FAQ
Anonymous

How to make clean url just in php

+ 发表回复

5 篇帖子 分页: 1 / 1


How to make clean url just in php

adrijan » 周一 7月 28, 2014 11:07 am

Hello i am newby in learning php
I like to know is it possible to make clean url just in php not using .htaccess rewriting
I have one small script which is like small website and i wish to have clean url but if is possible using only php
my url now is skripta.php?akc=proiz and i want it to be like skripta.php/proizvodi

I wish to upload here my script but i couldnt becose of security reasons of this website http://www.html.net
If anybody have some idea how i could solve this issue i will be appreachiated
头像

adrijan

  • 帖子: 11
  • 注册: 周一 7月 28, 2014 7:24 am

Re: How to make clean url just in php

XainPro » 周四 7月 31, 2014 9:20 am

you can not do this without url rewrite
url rewrite is very easy what the issue with url rewrite ?
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm

Re: How to make clean url just in php

adrijan » 周六 8月 02, 2014 10:25 pm

Did i need to make a rule for every link or i can make rule for generally all links on my site?
How you will solve link localhost/skripta.php?akc=proiz to show like localhost/scripta/proizvodi in htaccess ?
Sorry but i dont have any experience with it so i ask better someone who know if he can explaine to me
Thanks
头像

adrijan

  • 帖子: 11
  • 注册: 周一 7月 28, 2014 7:24 am

Re: How to make clean url just in php

XainPro » 周日 8月 03, 2014 6:11 pm

no you only need to create 1 rule in your htaccess file
here is a good tutorial where you can learn how to write your url redirection rule

http://www.smashingmagazine.com/2011/11 ... rewriting/
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm

Re: How to make clean url just in php

adrijan » 周六 8月 09, 2014 5:14 pm

I did some rewrite rule in my .htaccess and it is written like that:

RewriteEngine On
RewriteRule ^([^/]*)\.php$ /12dan/skripta.php?akc=$1 [L]

and my link is http://localhost/12dan/skripta.php?akc=proiz

But it show me some error
What did i wrong?
头像

adrijan

  • 帖子: 11
  • 注册: 周一 7月 28, 2014 7:24 am


+ 发表回复

分页: 1 / 1