I have a dayanmic website built in core PHP/MySql and hosted on one.com, I’m trying to make my URLs SEO Friendly by removing all Unnecessary signs from the URL, especially the variable ?someid=
I tried a lot of scripts using htaccess but nothing worked.
currently my url look like this: example.com/category.php?post-title=بعض-النص-يذهب-هنا
I want it to look like this: example.com/بعض-النص-يذهب-هنا
The title is stored in a MySql database.
as I mentioned I tried a lot of mod rewriting but nothing worked, here is one of the scripts I tried:
RewriteEngine On
RewriteBase /
RewriteRule ([^/]*).html category.php?post-title=$1
There is more scripts I tried, I can post them too if it’s important.
4
Answers
Try it like this in root directory and mod-rewrite must be enabled for rewriting,
Try below code
If any query follow below links
How to remove the querystring and get only the url?
Removing query string in PHP (sometimes based on referrer)
If i just follow your example you just need this rule:
But this will match every time the hole path.
Maybe you should prefix your category paths like
So every category has path like /category/بعض-النص-يذهب-هنا.html
All you need to use is this:
It will leave you with your desired URL of:
example.com/بعض-النص-يذهب-هنا
. Just make sure you clear your cache before testing this.