goseta
goseta

Reputation: 790

apache rewrite rule, looking in other folder

ok so I have this rewrite rule on my httpd.conf

<Directory /var/www/html/dev/html5>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)/(.*)$
RewriteRule ^.*$ snapshots/playlist-%2\.html [NC,L,PT]

RewriteCond %{HTTP_USER_AGENT} ^Mozilla(.*)MSIE\ 9.0(.*)$ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/dev/html5/#!/$1 [R,NC,NE,L]

RewriteRule ^.*$ index.html [NC,L,PT]

what I'm interested in is, when I have _escaped_fragment in the query string

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)/(.*)$

I want to look for the folder snapshots, but the folder is not inside html5 folder is one level up, so how can I look for that folder?? like this

RewriteRule ^.*$ ../snapshots/playlist-%2\.html [NC,L,PT]

thanks for any help!

Upvotes: 1

Views: 186

Answers (1)

Anthony Hatzopoulos
Anthony Hatzopoulos

Reputation: 10537

First you'll need to allow that folder permission by adding it in your vhost config

In other words you'll need to configure apache to allow the folder, so just like <directory icons> and <directory error docs> are setup by default. Maybe make it an alias:

Alias /snapshots/ "/var/www/html/dev/snapshots/"
<Directory "/var/www/html/dev/snapshots/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Then once it is aliased it will be available at example.com/snapshots/ so

RewriteRule ^.*$ /snapshots/playlist-%2\.html [NC,L,PT]

Upvotes: 1

Related Questions