0

I just want to ask help if how to do this in .htaccess

sample: https://sample.com/index.php?url=testimonials redirects to https://sample.com/testimonials

my htaccess rules:

Options -MultiViews
RewriteEngine On
RewriteRule ^home$ https://sample.com/ [R=301,L]
RewriteRule ^url=testimonials$ https://sample.com/testimonials/ [R=301,L]
RewriteRule ^error$ https://sample.com/ [R=301,L]
RewriteRule ^1$ https://sample.com/ [R=301,L]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,NE,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
vince
  • 162
  • 2
  • 10

1 Answers1

3

Could you please try following. Considering that your htaccess file and index.php file both present in root folder(These rules were provided before OP shared other already present htaccess rules).

RewriteEngine ON
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ index.php?url=$1 [L]
RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93
  • @vince, it worked fine for me when I checked, do you have any other rules in your htaccess file? Kindly do let me know on same. – RavinderSingh13 Nov 24 '20 at 11:37
  • it returns This site can’t be reached in the inner pages like the services page – vince Nov 24 '20 at 11:53
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/225026/discussion-between-vince-and-ravindersingh13). – vince Nov 24 '20 at 12:05