How can I customize rewrite URL.
Ex:
www.mywebsite.com/?op开发者_开发问答tion=com_press to www.mywebsite.com/news www.mywebsite.com/?option=com_press&id=1 to www.mywebsite.com/news/my-own-custom-title
Many thanks.
Depending on the server you're using, you have to setup the rewrite module for it accordingly. You should really provide more information on your setup in the original post too!
For the first rewrite, you need to setup a rule for /news
to become /?option=com_press
.
For the second, you need to get the ID in the URL somehow. I suggest using /news/123-my-post
and then rewrite that to /?option=com_press&id=123
. While you could probably make it lookup by the title as passed in the URL by creating a new url-slug
field or something, ID lookups are better for performance and wouldn't require any modification of your application.
No one can provide anything specific until you post what kind of server you're using! Apache, nginx, Cherokee, lighttpd and so on all have different modules that differ in how they manage their syntax and setup so we can't help you any further.
精彩评论