Home Set URL subdirectory in a GET element
Reply: 0

Set URL subdirectory in a GET element

user1688 Published in May 24, 2018, 3:59 pm

I have following directory on my Server:

Document Root
|- index.php 
|- /wiki
|    |
|    |-index.php
|    |
|    |-home.md
|    | 
|    |-foo.md
|    |
|    |-folder
|    |   |
|    |   |- foo.md

... and so on

I would like rewrite the ULR for the Wiki path. For example:


Should be server side




Should be server side


My idea is, transform the subdirectories to a GET element. In PHP, I can split the directory by / and perform my evaluation (PHP). After the wikifolder could be endless subfolder.

I use Apache (Plesk as Webserver) and PHP 7.

I tried following code in .htaccess:

RewriteEngine on
RewriteRule ^/wiki/(.*) /wiki/?page=$1

and my PHP code for testing (/wiki/index.php)

echo 'Hello Wiki';    
echo $_GET['page'];

If I call http://DOMAIN.dtl/wikii got the wiki page. If I call http://DOMAIN.dtl/wiki/testI got the 404 ERROR.

My question is: where is my mistake. I'm very grateful for every hint.


change my htaccess file to :

RewriteEngine on
RewriteRule ^wiki/(.*) wiki?page=$1

Now I got following error message (Browser Safari): ERROR: Too many redirections

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.345203 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO