delux
delux

Reputation: 1876

rewriting with .htaccess in subfolder doesn't work

I have this structure of my page:

www.examplepage.com

in root I have:

.htaccess
/subfolder1
/subfolder1/subfolder2
/subfolder1/subfolder2/image.html

so I want when user will enter in the URL:

www.examplepage.com/subfolder1/subfolder2/page/SOME_ID

to be redirected to

www.examplepage.com/subfolder1/subfolder2/image.html?id=SOME_ID

I shouldn't mess with the .htaccess, so I created

/subfolder1/subfolder2/.htaccess

so the .htaccess in the root has this code (It should remain the same):

<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

the .htaccess that I added in the subfolder2 has the following code:

<IfModule mod_rewrite.c>
    Options -Indexes
    RewriteEngine On

    RewriteCond %(REQUEST_FILENAME) !-f
    RewriteCond %(REQUEST_FILENAME) !-d
    RewriteRule ^page/([a-z0-9]+)$ /image.html?id=$1 [L]
</IfModule>

so what I'am doing wrong in the .htaccess in the subfolder2 ?

Upvotes: 3

Views: 772

Answers (1)

anubhava
anubhava

Reputation: 784948

In the `/subfolder1/subfolder2/.htaccess have this code:

<IfModule mod_rewrite.c>
    Options -Indexes
    RewriteEngine On
    RewriteBase /subfolder1/subfolder2/

    RewriteCond %(REQUEST_FILENAME) !-f
    RewriteCond %(REQUEST_FILENAME) !-d
    RewriteRule ^page/([a-z0-9]+)/?$ image.html?id=$1 [L,NC,QSA]
</IfModule>

Upvotes: 1

Related Questions