.htaccess - htaccess rewrite ?p= (I don't understand the code) -


i think have read can htaccess rewrites , still can't make heads or tails of whats going on. re made website work , except last designer did crazy php stuff , urls used have ?=p(pagename) want rewite (pagename).php redirect them 301 able 301 redirects works can't figure out how rewrite ?p=(pagename) (pagename).php

you want matching against actual requests, internally rewrite query string:

rewriteengine on  # 301 redirect php file rewritecond %{the_request} \ /\?p=([^&\ ]+)&?([^\ ]*) rewriterule ^ /%1.php?%2 [l,r=301]  # internally rewrite query string rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)\.php$ /?p=$1 [l,qsa] 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -