Click here to Skip to main content
15,882,152 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to use mod_rewrite to change the url. I have the following syntax in my .htaccess file on my apache server:

RewriteRule https://%{SERVER_NAME}/(.Contact_Us) https://%{SERVER_NAME}/?action=$1


I am trying to get this = "^http://localhost?action=Contact_Us" to look like this: "http://localhost/Contact_Us".

When I type the Url in the browser I get a http 404 error (page not found)

How do I do it; please let me know.

What I have tried:

I have tried various variations of my code but nothing has worked.
Posted
Updated 15-Jan-20 14:29pm
Comments
Mohibur Rashid 15-Jan-20 20:12pm    
try
```
RewriteRule "^/Contact_Us$" "/?action=Contact_Us"
RewriteRule "^/Contact_Us&(.*)$" "/?action=Contact_Us&$1"
```

1 solution

RewriteRule ^/Contact_Us /?action=Contact_Us
mod_rewrite - Apache HTTP Server Version 2.4[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900