Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After about four days of experimenting, I ended up with a somewhat different solution than I had originally expected to find. I simply removed all the actual URL manipulation to my index.php file and routed all requests through there. Here is my (much cleaner) .htaccess file:</p> <pre><code>Options +FollowSymlinks RewriteEngine On RewriteCond %{QUERY_STRING} (.*) RewriteRule (.*) index.php?path=$1 [QSA,L] </code></pre> <p>and here is the block of code I used to parse the entered URL:</p> <p>preg_match_all('|/([A-Za-z0-9]+)<em>((?!/)[A-Za-z0-9-</em>.]*)|', $_GET['path'], $matches);</p> <pre><code> // Remove all '$_GET' parameters from the actual $_GET superglobal: foreach($matches[0] as $k =&gt; $v) { $search = '/' . substr($v, 1); $_GET['path'] = str_replace($search, '', $_GET['path'], $count); } // Add $_GET params to URL args for ($i = 0; $i &lt; count($matches[1]); $i++) { self::$get_arguments[$matches[1][$i]] = $matches[2][$i]; } // Retrieve all 'cmd' properties from the URL and create an array with them: preg_match_all('~(cmd[0-9]*)/(.+?)(?=(?:cmd)|(?:\z))~', $_GET['path'], $matches); if (isset($matches[1][0])) { return self::$url_arguments = array_combine($matches[1], $matches[2]); </code></pre> <p>On a URL like this:</p> <pre><code>http://localhost/frame_with_cms/frame/www/cmd/one/cmd2/two/cmd3/three/cmd4/four/getparam_valuepart1_valuepart2/cmd5/five/ </code></pre> <p>It successfully produces these separate arrays which I then use to handle requests:</p> <pre><code>Array ( [getparam] =&gt; valuepart1_valuepart2 ) Array ( [cmd] =&gt; one/ [cmd2] =&gt; two/ [cmd3] =&gt; three/ [cmd4] =&gt; four/ [cmd5] =&gt; five/ ) </code></pre> <p>Thanks to all who took the time to read and reply.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload