Reputation: 23
Banging my head over the wall and can't find an appropriate solution.
I have the following htaccess code in my root/main directory:
<IfModule mod_rewrite.c>
RewriteOptions inherit
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteEngine On
# browser requests PHP
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]
# check to see if the request is for a PHP file:
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^/?(.*)$ /$1.php [L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
</IfModule>
Then i have a subdirectory called /classic-wow/ .
In it, I have a file called buy-account.php?id=12345&ad=advertising-title
I seek a solution that will turn the url into: buy-account/12345/advertising-title
So far, the htaccess in the main/root directory is omitting the .php which is good, however, I am unable to convert the parameters into a clean url ?id=12345&ad=advertising-title -> /12345/advertising-title
How to do this? Is additional .htaccess required in the subdirectory classic /root/classic-wow/ or it can be done from the root?
Upvotes: 0
Views: 79
Reputation: 786021
Inside classic-wow/.htaccess
, you may use this rule:
Options -MultiViews
RewriteEngine On
RewriteRule ^(buy-account)/([\w-]+)/([\w-]+)/?$ $1.php?id=$2&ad=$3 [L,QSA,NC]
Upvotes: 0