Reputation: 527
I've a problem with one htaccess rule, i need that if someone call an non existent url with a specific syntax like:
http://www.somesite.com/somefolder/somefolder/123456978/unexistant_folder_nor_file_2015
where http://www.somesite.com/somefolder/somefolder/ exist and 123456978/unexistant_folder_nor_file_2015 does not exist
the URL called will be passed to a script with below syntax:
http://www.somesite.com/somefolder/somefolder/index.php?id=/12345678/unexistant_folder_nor_file_2015
(where somefolder is always a folder with same name like, as example, test)
i tried below code:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^somefolder/([^/]+)/([^/]+)$ /somefolder/somefolder/index.php?id=$1 [L, NC]
but doesn't work can someone give me some advice to solve this problem?
thank you
Upvotes: 1
Views: 202
Reputation: 785246
You can use this rule inside /somefolder/somefolder/.htaccess
:
RewriteEngine On
RewriteBase /somefolder/somefolder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\d+/.*)$ index.php?id=$1 [L,QSA]
Upvotes: 1