Forum Moderators: phranque
Like this:
/index.html
/glossary.html
/resources.html
/archives.html
/dynamic/page/file-links-to-pages-below
/dynamic/page/glossary.html
/dynamic/page/resources.html
/dynamic/page/archives.html
So I know basically what I want to do: set rules for each root-level static page that if the filename is one of those files and not requested from root, then permanently redirect to the /fromroot.html version. I've also considered checking to see if the request actually exists as a file, and if not, redirect -- but that seemed like it might have unforeseen consequences.
Make sense? I've tried a few regular expressions unsucessfully. I know what I'll be trying is something like this:
RewriteRule ^([a-zA-Z0-9-_ ]+)/glossary.html$ /glossary.html [R=301,L]
One for each page, 5 total. That was my last wild guess at a solution, am I on the right track? Basically it just needs to redirect any request for that file not from root, back to root.
For .htaccess, I'd recommend:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^.+/glossary\.html$ /glossary.html [R=301,L]
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^/.+/glossary\.html$ /glossary.html [R=301,L]
Flush your browser cache before testing any change to your access-control code.
Jim
Just a stab in the dark: (untested)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !(a¦b¦c)\.html
RewriteRule ^(.*)$ /$1 [R=301,L]
Actually I'm not exactly sure whether you are proposing that code as a solution, or whether you're looking for the oppositie of that code... English conversational usage conventions often conflict with those of logic.
Jim