Link to home
Start Free TrialLog in
Avatar of talktome_prashanth

asked on

mod rewrite help

I need to rewrite some URL's using Mod ReWrite Apache Module. Below is the incoming URL 

This needs to be rewrited to below url

Anyone please help me out with .htaccess file. I need this only for subdomain. so I assume we need to place this .htaccess in subdomain directory only.

Thanks in advance.
Avatar of ravenpl
Flag of Poland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of talktome_prashanth


Looks like its not working.

I am getting the same old URL.
Any other additional steps to make sure apache takes .htaccess?
Is any RewriteRule working there? Verify the apache log.
To use RewriteEngine You need to be allowed to Override FileInfo. Refer
Also - You may need set RewriteBase (or change the rule) if the .htaccess is placed not in root of VirtualHost
Yeah top domain is working. I tested with wordpress permlinks.

This is info in my httpd.conf

<Directory /var/www/Domain/subdomain>
   Options FollowSymLinks
   AllowOverride All

<VirtualHost 65.x.x.x:80>
DocumentRoot /var/www/domain/subdomain

.htaccess is placed under root folder i,e   /var/www/domain/subdomain

Error log says 302 not found. Please let me know if u need additional information.
Got to working... after moving to http.conf.

Ah - my fault. in htaccess the leading / is stripped.
RewriteRule ^story/(.*) /story.php?id=$1 [L]
Looks like id is not supplied to the rewrited URL. It just showing me blank page. Any idea?
Its working if I replace the rule with this
RewriteRule ^story/([0-9][0-9])/$ /story.php?id=$1 [L]