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]
有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top