Question

I need to rewrite a directory and all is contents to a new directory however I am having issues I think due to the source directory having a full stop in it.

i.e.

http://example.com/1.0/ to http://example.com/newfolder/

Here is the rule I am trying

RewriteEngine On
RewriteBase /

RewriteRule ^1\.0$ http://example.com/newfolder/ [NC,R=301,L]
Était-ce utile?

La solution

You can use:

RewriteEngine On

RewriteRule ^1\.0(/.*)?$ http://example.com/newfolder$1 [R=301,L]

This will redirect /1.0/anything to /newfolder/anything

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top