Rewritten urls without extension

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 04 Oct 2013, 02:31

Rewritten urls without extension

07 Nov 2014, 20:29

hi

I am using this code to rewrite my urls:
RewriteRule ^/([^/]+)/([^/]+)\.htm$ /index.asp?subpage=$2&mainpage=$1

www.mysite.com/index.asp?subpage=wine&mainpage=drinks
www.mysite.com/drinks/wine.htm

This works fine, but now i want to get rid of the .htm extension
For example: www.mysite.com/drinks/wine

I tried to modify the RewriteRule, but it does not work of i change it to:

RewriteRule ^/([^/]+)/([^/]+)$ /index.asp?subpage=$2&mainpage=$1

Css and js are not loaded

What am i doing wrong?

Thanks Martin

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Rewritten urls without extension

10 Nov 2014, 05:52

Hello, Martin

"Css and js are not loaded"
- this usually happens when paths to css and js resources are relative.
Please consider using root-relative or absolute paths and the issue will disappear.
In your new pattern the folder structure is different: /drinks/wine is 2 levels of folders while drinks/wine.htm is just one.

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 17 guests