php - Is it possible to do Double mod_rewrite? -


so build simple mvc app because want learn new stuff. everething thing work need change url

in .httacces

<ifmodule mod_rewrite.c>     rewriteengine on     rewritebase /mymvc/     rewritecond %{request_filename} !-f     rewritecond %{request_filename} !-d     rewriterule ^(.*)$ index.php?%{query_string} [ne,l]     rewriterule .* - [e=http_authorization:%{http:authorization},l] </ifmodule> 

and url http://mysite/mymvc/about

were controller,but if move in root be

http://mysite/about

but don't want .. want

http://mysite/page:about

now problem use explode('/',$path)

$path = $_server['request_uri']; 

because folder use second array , if change http://mysite/page:about there no / ..

i have seen people use prefix of file name let : page_about.php

so url http://mysite/mymvc/page/about

but still ugly .. tips

instead of using explode try:

preg_split("/:|\//", $path); 

this explode either : or /.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -