OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

.htaccess for replacing Query parameters with forward slash

  • Thread starter Thread starter Adir
  • Start date Start date
A

Adir

Guest
I'm trying to create an .htaccess file to replace query parameters with a forward slash. The URL changes successfully but I get a 404.

Basically, I want the url to be like:

domain.com/value

Instead of:

domain.com/index.php?id=value

This is my .htaccess file:

Code:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=([^&]+)$
RewriteRule ^index\.php$ /%1? [R=301,L]
RewriteRule ^value$ index.php?id=value [L]
<p>I'm trying to create an .htaccess file to replace query parameters with a forward slash.
The URL changes successfully but I get a 404.</p>
<p>Basically, I want the url to be like:</p>
<p>domain.com/value</p>
<p>Instead of:</p>
<p>domain.com/index.php?id=value</p>
<p><strong>This is my .htaccess file:</strong></p>
<pre><code>RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=([^&]+)$
RewriteRule ^index\.php$ /%1? [R=301,L]
RewriteRule ^value$ index.php?id=value [L]
</code></pre>
Continue reading...
 

Latest posts

ن
Replies
0
Views
1
نعمان منذر محمود الجميلي
ن
Top