.HTACCESS rewriting a url the basic

时间:2015-05-12 23:05:05

标签: php apache .htaccess mod-rewrite url-rewriting

i have 2 questions regarding .htaccess,

1- if i use .htaccess to rewrite the url's on my website does it affect any of the requests or do i need to change the link for all forms for example if a action post for a form is index.php?submit do i need to change that link ? when i for example hide .php extension in .htaccess or it doesn't affect it

2-how do i basically hide all .php extensions

3- if i have the below url

www.link.com/post.php?post_id=53&post_name=the-International-day-in-roma

how do i make .htaccess rewrite it to the following

www.link.com/post/the-International-day-in-roma

does it matter if there was commas or can we remove them also ?

www.link.com/post.php?post_id=53&post_name=everyday,-or-today,-or-tomorrow

1 个答案:

答案 0 :(得分:-1)

you can hide php file name in htaccess for example if someone click this link

-\\\\+

htaccess file contverts the url to post.php and call the the post name by www.link.com/post/the-International-day-in-roma/ it represents this part "$1" the it is dynamic and it can be changed !

/([a-zA-Z0-9_-]+)/