Mr.Valentine
Mr.Valentine

Reputation: 63

Web.config to .htaccess cannot work

I have been trying to convert the web.config below to .htaccess. web.config is working, but not the one I convert to .htaccess.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteBase" stopProcessing="true">
<match url="[?\.\/]" />
<action type="None" />
</rule>
<rule name="RewriteTemplate">
<match url="^([0-9a-zA-Z_]+)" />
<action type="Rewrite"
url="/?PAGENAME={R:1}"
appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
<system.serviceModel>
<behaviors />
</system.serviceModel>
</configuration>

Below is what is have convert, and doesn't work.

RewriteEngine On
RewriteCond %{REQUEST_URI} [?\.\/][L]
RewriteRule ^([0-9a-zA-Z_]+) /?PAGENAME=$1 [QSA,L]

I spent 3 hours surfing the website, but cant make it work. I want it, if the url doesnt have any "." then proceed to next one. get any words after original domain "xxx.xx.com/abc" <-get abc in this case. I'm completely out of mind now ;( what I have doing wrong?

Upvotes: 1

Views: 71

Answers (1)

Croises
Croises

Reputation: 18671

You can use that in your .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_URI} ![.]
RewriteRule ^([0-9a-zA-Z_]+) /?PAGENAME=$1 [QSA,L]

Upvotes: 1

Related Questions