htaccess redirect back to HTTP_REFERER for some specific pages
I want to redirect to http referer page using mod rewrite htaccess.
For example, a url request is generated from service.html. I want to redirect back to services.html and if a request is generated from portfolio.html redirect back to portfolio.html.
Some one may found it silly, but I am in a problem that the same URL is generated within services and portfolio page that belongs to only them not each other's pages.
Example of link generated are:
example.com/design.html example.com/market.html
For referer:
examp开发者_Go百科le.com/service.html
While same for portfolio:
example.com/design.html example.com/market.html
For referer:
exaple.com/portfolio.html
I think it could be achieved by %{HTTP_REFERER} but I don't know how.
This is one way I understand your question:
RewriteCond %{HTTP_REFERER} exaple\.com/(service|portfolio)\.html
RewriteRule /(design|market)\.html http://exaple.com/%1.html [redirect,last]
The other is this:
RewriteCond %{HTTP_REFERER} exaple\.com/service\.html
RewriteRule /design\.html http://exaple.com/service.html [redirect,last]
RewriteCond %{HTTP_REFERER} exaple\.com/portfolio\.html
RewriteRule /market\.html http://exaple.com/portfolio.html [redirect,last]
精彩评论