user1438538
user1438538

Reputation: 1

url rewriting doesnt work for pages in subdomain

I need to change abc.mydomain.com/xyz.php?id3=se to abc.mydomain.com/xyz/se/ with url rewriting. Here is my code in .htaccess (placed in abc folder)

 Options +FollowSymLinks
 RewriteEngine on
 RewriteRule /xyz/([0-9a-zA-Z]+) /xyz.php?id3=$1

I'm using a hosted server.

also tried without Options +FollowSymLinks but still doesn't work. appreciate any advice from someone please.

Upvotes: 0

Views: 89

Answers (2)

Waiyl Karim
Waiyl Karim

Reputation: 2950

I guess you have to remove the "/" from "/xyz.php?id3=$1". You are in abc folder '/www/abc', and your .htaccess is in the same folder, so the "/" makes the server thinks that the page xyz.php is in the root folder which is /www and not in /www/abc ! I had the same problem and I solved it this way! So try this code:

 Options +FollowSymLinks
 RewriteEngine on
 RewriteRule /xyz/([0-9a-zA-Z]+) xyz.php?id3=$1

Upvotes: 1

snøreven
snøreven

Reputation: 1974

Add the domainname in your rule:

RewriteRule http://example.com/xyz/([0-9a-zA-Z]+) http://example.com/xyz.php?id3=$1

Upvotes: 0

Related Questions