Benidorm
Benidorm

Reputation: 183

.htaccess redirect subdirectory to subdirectory

I want to redirect the URL http://example.com/sub-folder/filename.html to http://example.com/sub-folder/index.php?p=filename.html

I already have the following:

    <IfModule mod_rewrite.c>

    RewriteEngine On
    RewriteBase /
    #RewriteRule ^stedentrip-naar/([a-zA-Z0-9_-]+)\.html$  stedentrip-naar/index.php?p=$1 [L,NC,QSA]
    RewriteRule ^stedentrip-naar/(.*)$ /stedentrip-naar/$1 [R=301,NC,L]
    </IfModule>

Upvotes: 1

Views: 140

Answers (2)

anubhava
anubhava

Reputation: 784918

Place this rule in your /sub-folder/.htaccess:

RewriteEngine on
RewriteBase /stedentrip-naar/

RewriteRule ^([\w-]+\.html)$ index.php?p=$1 [L,QSA,NC]

Upvotes: 1

hpelleti
hpelleti

Reputation: 342

Try this:

RewriteEngine on 
RewriteRule ^sub-folder/([a-zA-Z0-9_-]+)\.html$ sub-folder/index.php?p=$1.html

Upvotes: 0

Related Questions