mod_rewrite without suffix show 404 error

Discuss practical ways rearrange URLs using mod_rewrite.

mod_rewrite without suffix show 404 error

Postby edi2004 » Mon Sep 22, 2008 11:41 am

I want to rewrite any url like this pattern:

http://my.site.com/my.cat/my.dog/

and it shows the output of:

http://my.site.com/mypage.php?category= ... cle=my.dog

but when i try this url:

http://my.site.com/my.cat/my.dog

it show the 404 error page.

this is my htaccess file content:

IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName my.site.com

RewriteEngine On

RewriteRule ^searchengine/([^/]*)/([^/]*)/$ /search_engine.php?query=$1&pages=$2 [L]
RewriteRule ^searchengine/([^/]*)/$ /search_engine.php?query=$1 [L]
RewriteRule ^searchengine/$ /search_engine.php? [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/$ /show_article.php?category=$1&article=$2&pages=$3 [L]
RewriteRule ^([^/]*)/([^/]*)/$ /show_article.php?category=$1&article=$2 [L]
RewriteRule ^([^/]*)/$ /show_article.php?category=$1 [L]

Thank you in advance.
edi2004
 
Posts: 2
Joined: Mon Sep 22, 2008 11:27 am

Postby edi2004 » Mon Sep 22, 2008 3:37 pm

I am also creating a subdomain that special for WAP mobile users.
But the subdomain was is a directory that below the public_html where is located the .htaccess file, so the page was redirected to the same URI but different subdomain.

Anyone can help me?
edi2004
 
Posts: 2
Joined: Mon Sep 22, 2008 11:27 am

Postby richardk » Tue Sep 23, 2008 12:10 pm

Try
Code: Select all
Options +FollowSymLinks
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
AuthName my.site.com

<Limit GET POST>
  Order deny,allow
  Deny from all
  Allow from all
</Limit>
<Limit PUT DELETE>
  Order deny,allow
  Deny from all
</Limit>

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]

RewriteRule ^searchengine/([^/]+)/([^/]+)/?$ /search_engine.php?query=$1&pages=$2 [L]
RewriteRule ^searchengine/([^/]+)/?$         /search_engine.php?query=$1          [L]
RewriteRule ^searchengine/?$                 /search_engine.php?                  [L]

RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /show_article.php?category=$1&article=$2&pages=$3 [L]
RewriteRule ^([^/]+)/([^/]+)/?$         /show_article.php?category=$1&article=$2          [L]
RewriteRule ^([^/]+)/?$                 /show_article.php?category=$1                     [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 28 guests

cron