php - Include GET variables in .htaccess redirect -


यहाँ मेरी .htaccess कोड है:

  #Rewrite सेटिंग्स विकल्प + FollowSymlinks # RewriteEngine पर यूआरएल RewriteCond% से index.php निकालें {THE_REQUEST} ^ [AZ] {3,9} \ /(.*) सूचकांक \ .php ($ | \ |? \) RewriteRule ^ /% 1 [आर = 301, एल] #Add स्लैश RewriteBase / RewriteCond% {REQUEST_FILENAME}! -f RewriteCond% {REQUEST_URI}! (। *) / $ RewriteRule ^ (। *) $ / $ 1 / [एल, आर = 301] #Make पूरे यूआरएल चर RewriteRule ^ (। * /) $ /index.php?path=$1 [आर = 301]   

मैं उप में से किसी में फ़ाइलों का नाम "index.php" के लिए सभी अनुरोधों पुनर्निर्देशित करने के लिए चाहते हैं रूट के लिए निर्देशिका "index.php" पथ के साथ एक get चर के रूप में तो:

  http://mywebsite.com/this/is/the/path/index.php हो जाता है: http://mywebsite.com/index.php?path=this/is / The / path /   

यह वर्तमान में काम करता है हालांकि, समस्या यह है कि यदि मूल यूआरएल में उसमें चर चर है, तो उन्हें हटा दिया जाता है और पथ में शामिल नहीं किया जाता है। इसलिए:

  http://mywebsite.com/this/is/the/path/index.php?get=variables बनना चाहिए: http://mywebsite.com/index.php? पथ = यह / है / पथ /% 3Fget% 3Dvariables   

यह कैसे किया जा सकता है? मैं यूआरएल के लिए नए सिरे से लिख रहा हूं और इस तरह से व्यवहार करने के लिए मेरे कोड को प्रतीत नहीं कर पा रहा हूं।

आपकी मदद के लिए धन्यवाद।

आप सिर्फ इस तरह क्वेरी स्ट्रिंग संलग्न (QSA) ध्वज जोड़ने की जरूरत है: (। * /)

  RewriteRule ^ $ /index.php? पथ = $ 1 [आर = 301, क्यूएसए]    

Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -