Remove folder from url

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 3
Joined: 03 Dec 2012, 20:58

Remove folder from url

03 Dec 2012, 21:01

Hi

I need to remove a folder from every dynamically created url, for example:

http://forum.mydomain.com/forum/forum_p ... 706#216706

needs to redirect to

http://forum.mydomain.com/forum_posts.a ... 706#216706

Can anybody help?

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Remove folder from url

03 Dec 2012, 22:37

Hello,

try to use the following:

Code: Select all
RewriteEngine on
RewriteBase /

RewriteRule ^forum/forum_posts\.asp$ /forum_posts.asp [NC,QSA,R=301,L]
RewriteRule ^forum_posts\.asp$ /forum/forum_posts.asp [NC,QSA,L]


Regards
Andrew

User avatar
Posts: 3
Joined: 03 Dec 2012, 20:58

Re: Remove folder from url

04 Dec 2012, 05:32

I tried that Andrew but I just get a 404 page error.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Remove folder from url

04 Dec 2012, 11:59

Ok, do you get 301 redirect?

regards
Andrew

User avatar
Posts: 3
Joined: 03 Dec 2012, 20:58

Re: Remove folder from url

04 Dec 2012, 12:11

Yes it redirects the url correctly but it says 'The page cannot be found', and the #216706 is removed from the url.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Remove folder from url

04 Dec 2012, 22:39

Oh, the '#' will not work. It's something your browser processes and performs, not the server, so server will simply drop it after redirect. This could be the problem.
Please, provide rewrite.log for the testing request. Logging issues described in FAQ

Regards
Andrew

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 31 guests