How do I write this url [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I know that there has been question concerning url re-write but the once I have seen have not solved my problem.
I have to edit this question.
Forward slash is not working when I am re-writing a url. WHat do I do

([a-zA-Z0-9-])+ => any alpha numeric combination with hyphen (-)
/? => may or may not end with /
that is
domain.com/name/abcd-efg/21
or
domain.com/name/abcd-efg/21/
The NC is important.
RewriteEngine On
RewriteRule ^name/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)\/?/?$ index.php?var=$1&spell=$2 [NC,L]

Related

Removing ?id= from URL using .HTAccess [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a page
root/pages/?id=webdesign
and I want to translate it into something like
root/pages/webdesign
To keep the prefix and replace the last part with a query string
RewriteCond %{QUERY_STRING} !^id=
RewriteRule ^root/pages/(.+)$ /root/pages/?id=$1 [L]
The RewriteCond is needed to prevent a rewrite loop.

Resolve url.html/comment-page-1 to url/comment-page-1 through htaccess [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Some days back, I have changes WordPress URL's to URL.html via .htaccess. I Know it was very smart move. As google crawled all tne pages, but there were too much 404 error in Webmaster Tools. After some days later I have removes .html from URL. but the real problem happens later.
Now my problem is:
I want to changes the URL.html/comment-page-1 to URL/comment-page-1 (default). I am not good with .htaccess. So please help me.
You can use this redirect rule before other wordpress rules:
RewriteRule ^([^.]+)\.html/(.*)$ /$1/$2 [L,NC,NE,R=301]

How do I make my rewrite rule in my .htaccess file? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a path of /posts/Bob/53c6acf8963e3/
Where posts relates to a file called post.php.
Bob is a username and 53c6acf8963e3 is a unique string.
so it should relate to something like post.php?username=bob&unique_string=53c6acf8963e3
But I don't want to use that as it doesn't look nice aha.
What htaccess rule could I use?
You can use this rules :
RewriteEngine on
RewriteRule ^([\w]+)/([\w]+)/([\w]+)/?$ $1.php?username=$2&unique_string=$3 [QSA,L]
See more on QSA flag here.
RewriteEngine on
RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z0-9]+)/?$ $1.php?username=$2&unique_string=$3 [NC,L]

How to change URLs Using rewriterules in .htaccess? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have URL that will be like that :
http://example.com/directory/index.php?q=anything
so that the PHP will load the test variable using $_GET['q'].
I wish to simplify this in my .htaccess to :
http://example.com/directory/anything.html
How would i go about doing this?
May be you could add something like this in .htaccess
RewriteEngine on
RewriteRule ([0-9A-Za-z-\+._]+)\.html$ ./index.php?q=$1
I have Myself resolve this issue ::
here's The .htaccess code
RewriteEngine On
RewriteRule ^directory/([^/]*)\.html$ /directory/index.php?q=$1 [L]

htaccess rewrite statment required [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to change the url of the below
http://mywebsite/address.php?state=oh&office_id=1426&l_name=%20IRONTON
to be
http://mywebsite/office/IRONTON.php
IRONTON.php is a fake page, and state=oh&office_id=1426&l_name=%20IRONTON are variables, so state, office_id and l_name will change every time
so I want the real url only to be changed as the above.
RewriteEngine on
RewriteRule ^office/IRONTON\.php$ address.php?state=oh&office_id=1426&l_name=%20IRONTON [QSA]

Categories