Reputation: 864
I'm starting to feel a bit stupid now. For the first time I'm working without an established PHP framework like CI or Laravel and I have an issue with the htaccess redirecting the folder path structure to the index file in the folder.
Here's an Example: I have four urls as follows:
http://www.example.com <-- this is a WurstPress site - the client's choice, not mine)
http://www.example.com/user <-- "user" is an actual folder with an index.php file in it
http://www.example.com/user/settings/private
http://www.example.com/user/settings/public
The issue is that I can get to the WP site on the root and I can get to the /user url no problem. But the two settings urls I want to be rewritten to the /user/index.php file with the full url path included, just like CI or Laravel so that i can get the segments of the url, something like this: http://www.example.com/user/index.php/settings/private I DO NOT want to redirect the user there, but I need the index.php script to look at the request uri and see the /user/index.php/settings/private path.
I've been struggling with this for too long and I know it's something stupid simple I'm just not seeing, so I appreciate everyone's help here.
Here's my .htaccess file:
<IfModule mod_rewrite.c>
Options +FollowSymLinks -Indexes
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^/user/(.*) /user/index.php$1 [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Please remember that I can't dork up the client's WP site so I can't change the base path and I need to leave the WP stuff there too. I added my code above that. I've tried probably a hundred or more various combinations of that one line for the user path.
In my user/index.php file I'm at the moment simply trying to output the request URI but I'm just getting the WP page not found page instead.
Upvotes: 1
Views: 557
Reputation: 339
RewriteRule ^user/(.*)$ user/index.php$1 [L]
Also you may want to do this instead:
RewriteRule ^user/(.*)$ user/index.php?request=$1 [L]
Upvotes: 1