url rewriting - Remove directory from URL. Web.Config URLRewrite -
i working on little web project expand knowledge in web development. not have domain working server ips. current web.config
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <rewrite> <rules> <rule name="hide .html ext"> <match ignorecase="true" url="^(.*)"/> <conditions> <add input="{request_filename}" matchtype="isfile" negate="true"/> <add input="{request_filename}" matchtype="isdirectory" negate="true"/> <add input="{request_filename}.html" matchtype="isfile"/> </conditions> <action type="rewrite" url="{r:0}.html"/> </rule> <rule name="redirecting .html ext" stopprocessing="true"> <match url="^(.*).html"/> <conditions logicalgrouping="matchany"> <add input="{url}" pattern="(.*).html"/> </conditions> <action type="redirect" url="{r:1}"/> </rule> </rules> </rewrite> <defaultdocument> <files> <clear /> <add value="landing.html" /> <add value="landing.asp" /> <add value="landing.htm" /> <add value="default.htm" /> <add value="default.asp" /> <add value="index.htm" /> <add value="index.html" /> <add value="iisstart.htm" /> <add value="default.aspx" /> </files> </defaultdocument> <handlers> <clear /> <add name="php53_via_fastcgi" path="*.php" verb="get,head,post" type="" modules="fastcgimodule" scriptprocessor="c:\program files (x86)\php\v5.3\php-cgi.exe" resourcetype="either" requireaccess="script" allowpathinfo="false" precondition="" responsebufferlimit="4194304" /> <add name="rules-integrated" path="*.rules" verb="*" type="system.servicemodel.activation.httphandler, system.servicemodel, version=3.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" modules="managedpipelinehandler" scriptprocessor="" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="integratedmode" responsebufferlimit="4194304" /> <add name="rules-isapi-2.0" path="*.rules" verb="*" type="" modules="isapimodule" scriptprocessor="c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness32" responsebufferlimit="4194304" /> <add name="rules-64-isapi-2.0" path="*.rules" verb="*" type="" modules="isapimodule" scriptprocessor="c:\windows\microsoft.net\framework64\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness64" responsebufferlimit="4194304" /> <add name="xoml-integrated" path="*.xoml" verb="*" type="system.servicemodel.activation.httphandler, system.servicemodel, version=3.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" modules="managedpipelinehandler" scriptprocessor="" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="integratedmode" responsebufferlimit="4194304" /> <add name="xoml-isapi-2.0" path="*.xoml" verb="*" type="" modules="isapimodule" scriptprocessor="c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness32" responsebufferlimit="4194304" /> <add name="xoml-64-isapi-2.0" path="*.xoml" verb="*" type="" modules="isapimodule" scriptprocessor="c:\windows\microsoft.net\framework64\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness64" responsebufferlimit="4194304" /> <add name="svc-isapi-2.0-64" path="*.svc" verb="*" type="" modules="isapimodule" scriptprocessor="%systemroot%\microsoft.net\framework64\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness64" responsebufferlimit="4194304" /> <add name="svc-isapi-2.0" path="*.svc" verb="*" type="" modules="isapimodule" scriptprocessor="%systemroot%\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness32" responsebufferlimit="4194304" /> <add name="svc-integrated" path="*.svc" verb="*" type="system.servicemodel.activation.httphandler, system.servicemodel, version=3.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" modules="managedpipelinehandler" scriptprocessor="" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="integratedmode" responsebufferlimit="4194304" /> <add name="webdav" path="*" verb="propfind,proppatch,mkcol,put,copy,delete,move,lock,unlock" type="" modules="webdavmodule" scriptprocessor="" resourcetype="unspecified" requireaccess="none" allowpathinfo="false" precondition="" responsebufferlimit="4194304" /> <add name="aspclassic" path="*.asp" verb="get,head,post" type="" modules="isapimodule" scriptprocessor="%windir%\system32\inetsrv\asp.dll" resourcetype="file" requireaccess="script" allowpathinfo="false" precondition="" responsebufferlimit="4194304" /> <add name="securitycertificate" path="*.cer" verb="get,head,post" type="" modules="isapimodule" scriptprocessor="%windir%\system32\inetsrv\asp.dll" resourcetype="file" requireaccess="script" allowpathinfo="false" precondition="" responsebufferlimit="4194304" /> <add name="isapi-dll" path="*.dll" verb="*" type="" modules="isapimodule" scriptprocessor="" resourcetype="file" requireaccess="execute" allowpathinfo="true" precondition="" responsebufferlimit="4194304" /> <add name="tracehandler-integrated" path="trace.axd" verb="get,head,post,debug" type="system.web.handlers.tracehandler" modules="managedpipelinehandler" scriptprocessor="" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="integratedmode" responsebufferlimit="4194304" /> <add name="webadminhandler-integrated" path="webadmin.axd" verb="get,debug" type="system.web.handlers.webadminhandler" modules="managedpipelinehandler" scriptprocessor="" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="integratedmode" responsebufferlimit="4194304" /> <add name="assemblyresourceloader-integrated" path="webresource.axd" verb="get,debug" type="system.web.handlers.assemblyresourceloader" modules="managedpipelinehandler" scriptprocessor="" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="integratedmode" responsebufferlimit="4194304" /> <add name="pagehandlerfactory-integrated" path="*.aspx" verb="get,head,post,debug" type="system.web.ui.pagehandlerfactory" modules="managedpipelinehandler" scriptprocessor="" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="integratedmode" responsebufferlimit="4194304" /> <add name="simplehandlerfactory-integrated" path="*.ashx" verb="get,head,post,debug" type="system.web.ui.simplehandlerfactory" modules="managedpipelinehandler" scriptprocessor="" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="integratedmode" responsebufferlimit="4194304" /> <add name="webservicehandlerfactory-integrated" path="*.asmx" verb="get,head,post,debug" type="system.web.services.protocols.webservicehandlerfactory, system.web.services, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a" modules="managedpipelinehandler" scriptprocessor="" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="integratedmode" responsebufferlimit="4194304" /> <add name="httpremotinghandlerfactory-rem-integrated" path="*.rem" verb="get,head,post,debug" type="system.runtime.remoting.channels.http.httpremotinghandlerfactory, system.runtime.remoting, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" modules="managedpipelinehandler" scriptprocessor="" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="integratedmode" responsebufferlimit="4194304" /> <add name="httpremotinghandlerfactory-soap-integrated" path="*.soap" verb="get,head,post,debug" type="system.runtime.remoting.channels.http.httpremotinghandlerfactory, system.runtime.remoting, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" modules="managedpipelinehandler" scriptprocessor="" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="integratedmode" responsebufferlimit="4194304" /> <add name="axd-isapi-2.0" path="*.axd" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness32" responsebufferlimit="0" /> <add name="pagehandlerfactory-isapi-2.0" path="*.aspx" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness32" responsebufferlimit="0" /> <add name="simplehandlerfactory-isapi-2.0" path="*.ashx" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness32" responsebufferlimit="0" /> <add name="webservicehandlerfactory-isapi-2.0" path="*.asmx" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness32" responsebufferlimit="0" /> <add name="httpremotinghandlerfactory-rem-isapi-2.0" path="*.rem" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness32" responsebufferlimit="0" /> <add name="httpremotinghandlerfactory-soap-isapi-2.0" path="*.soap" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness32" responsebufferlimit="0" /> <add name="axd-isapi-2.0-64" path="*.axd" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework64\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness64" responsebufferlimit="0" /> <add name="pagehandlerfactory-isapi-2.0-64" path="*.aspx" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework64\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness64" responsebufferlimit="0" /> <add name="simplehandlerfactory-isapi-2.0-64" path="*.ashx" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework64\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness64" responsebufferlimit="0" /> <add name="webservicehandlerfactory-isapi-2.0-64" path="*.asmx" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework64\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness64" responsebufferlimit="0" /> <add name="httpremotinghandlerfactory-rem-isapi-2.0-64" path="*.rem" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework64\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness64" responsebufferlimit="0" /> <add name="httpremotinghandlerfactory-soap-isapi-2.0-64" path="*.soap" verb="get,head,post,debug" type="" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework64\v2.0.50727\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="script" allowpathinfo="false" precondition="classicmode,runtimeversionv2.0,bitness64" responsebufferlimit="0" /> <add name="cgi-exe" path="*.exe" verb="*" type="" modules="cgimodule" scriptprocessor="" resourcetype="file" requireaccess="execute" allowpathinfo="true" precondition="" responsebufferlimit="4194304" /> <add name="ssinc-stm" path="*.stm" verb="get,post" type="" modules="serversideincludemodule" scriptprocessor="" resourcetype="file" requireaccess="script" allowpathinfo="false" precondition="" responsebufferlimit="4194304" /> <add name="ssinc-shtm" path="*.shtm" verb="get,post" type="" modules="serversideincludemodule" scriptprocessor="" resourcetype="file" requireaccess="script" allowpathinfo="false" precondition="" responsebufferlimit="4194304" /> <add name="ssinc-shtml" path="*.shtml" verb="get,post" type="" modules="serversideincludemodule" scriptprocessor="" resourcetype="file" requireaccess="script" allowpathinfo="false" precondition="" responsebufferlimit="4194304" /> <add name="traceverbhandler" path="*" verb="trace" type="" modules="protocolsupportmodule" scriptprocessor="" resourcetype="unspecified" requireaccess="none" allowpathinfo="false" precondition="" responsebufferlimit="4194304" /> <add name="optionsverbhandler" path="*" verb="options" type="" modules="protocolsupportmodule" scriptprocessor="" resourcetype="unspecified" requireaccess="none" allowpathinfo="false" precondition="" responsebufferlimit="4194304" /> <add name="staticfile" path="*" verb="*" type="" modules="staticfilemodule,defaultdocumentmodule,directorylistingmodule" scriptprocessor="" resourcetype="either" requireaccess="read" allowpathinfo="false" precondition="" responsebufferlimit="4194304" /> <add name="wildcard script map" path="*" verb="*" type="" modules="isapimodule" scriptprocessor="c:\windows\microsoft.net\framework64\v4.0.30319\aspnet_isapi.dll" resourcetype="unspecified" requireaccess="none" allowpathinfo="false" precondition="classicmode,runtimeversionv4.0,bitness64" responsebufferlimit="4194304" /> </handlers> </system.webserver> </configuration>
everything in order it. works how need work. add rule removes /pages/ url. example, (server_ip)/pages/about needs (server_ip)/about. have removed file extensions in url don't need that. want directory removed url
Comments
Post a Comment