I am new to .htaccess and rewriting functions. I searched many pages, but I could not find a solution. Here is my problem:
I have URLs in these formats in the kurum.php file:
fxrehber.com/kurum.php?id=$krmID&sef=$sef
so my regular url:
http://fxrehber.com/kurum.php?id=7&sef=ata-foreks
related part of my .htaccess:
<IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On RewriteRule ^([0-9]+)-([a-zA-Z0-9-_]+)$ /kurum.php?id=$1&sef=$2 </IfModule>
Therefore, I can get the SEF URLs in this format:
http://fxrehber.com/7-ata-foreks
I have two questions:
1. Can this URL be changed to this format using .htaccess without moving the kurum.php file to a new directory?
http://fxrehber.com/kurumlar/7-ata-foreks
(I can add the / kurumlar directory via .htaccess, but my css link and image will not work)
2. Can I pass the id value without mentioning it in the SEF URL as follows:
http://fxrehber.com/kurumlar/ata-foreks (this is the best option for me)
If I cannot do this, do I only need to use the $ sef variable to select articles from the database? Is there a flaw in this?
I hope this is enough to explain my problem. Thanks.
source share