Mike
Mike

Reputation: 3024

simple url rewriting using htaccess

How can I rewrite

website.com/feed/file.xml 

to

website.com/feed 

using htaccess?

I need the user to access first line and show him the content from 2'nd line.

Edit 1: posted current .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule    ^feed?$    feed/sejururi.xml    [NC,L] 
</IfModule>

Upvotes: 1

Views: 114

Answers (2)

anubhava
anubhava

Reputation: 785256

I need the user to access first line and show him the content from 2'nd line.

This rule should for you in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On  

RewriteRule ^(feed)/sejururi\.xml$ /$1 [NC,L] 

UPDATE: Full .htaccess:

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

RewriteRule ^(feed)/sejururi\.xml$ $1 [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>

Upvotes: 1

MeNa
MeNa

Reputation: 1487

Try:

RewriteEngine On  
RewriteRule    ^feed?$    feed/file.xml    [NC,L] 

Upvotes: 0

Related Questions